4 Replies Latest reply on Mar 17, 2011 9:32 AM by Alejandro Mesias André Nebra Perez

    ExtendedDataTable don't change rowcount on filter

    Alejandro Mesias André Nebra Perez Newbie

           See, i've developed some pagination with ExtendedDataTable. It worlked very well, and i improved some stuff on my Grid layout. If you see the attached file, in the footer, at left has 3 numbers: the first result, the last and the total results. When i use the filter with pagination, no problem, my pagination brings me the total of results when I filter an list. If I use the internal filter, without pagination, i doesnt found an way to discover how many results the filtered data has. If i use binding it always show me the total registers of the original list, but not the total registers who i see.

           I know it returns correctly to me the total pages only, and the current, but not the total, thats my code for the footer, the magedbean for the footer.

       

       

      <ui:fragment xmlns:rich="http://richfaces.org/rich"             xmlns:h="http://java.sun.com/jsf/html"
                   xmlns:f="http://java.sun.com/jsf/core"
                   xmlns:a4j="http://richfaces.org/a4j"
                   xmlns:ui="http://java.sun.com/jsf/facelets">
          <h:panelGrid columns="2" styleClass="tabelarodape" style="width: 100%;"  id="pgscroller">
              <ui:param name="totalReg" value="#{mb.rowCount}"/>
              <ui:param name="regPerPage" value="#{mb.rows}"/>
              <ui:param name="dataTableSource" value="#{empty tableId ? 'tabela' : tableId}"/>
              <h:panelGrid columns="2" styleClass="tabelapagina">
                  <rich:datascroller id="ds" for="#{dataTableSource}" immediate="true" binding="#{mb.datascr}" pagesVar="totalPages" align="right" pageIndexVar="currpage"  page="#{mb.scrollerPage}" >
                      <f:facet name="pages">
                          <h:panelGroup>                        
                              <h:outputText value="Página "/> #The page selector
                              <h:inputText onchange="javascript:if(this.value.length>0) {document.getElementById(jQuery(this).closest('div[id$=ds]').attr('id')).component.switchToPage(this.value);} else {return false;}" disabled="#{totalPages == 1}"
                                           onkeyup="javascript:somente_numero(this, #{totalPages});" value="#{mb.scrollerPage}" size="2" id="sc1">
                              </h:inputText>                        
                              <h:outputText value="de  #{totalPages}" id="totpages"/>                        
                          </h:panelGroup>
                      </f:facet>
                  </rich:datascroller>
                  <h:selectOneMenu styleClass="selectrodape" value="#{mb.rows}">
                      <f:selectItems value="#{listfactory.listMap['ROWS']}"/>
                      <a4j:support event="onchange" reRender="#{dataTableSource}, pgscroller">
                          <f:setPropertyActionListener target="#{mb.scrollerPage}" value="1"/>
                      </a4j:support>
                  </h:selectOneMenu>
              </h:panelGrid>
              <h:outputText style="float: right;" value="Ver #{currpage*regPerPage - regPerPage + 1} - #{currpage*regPerPage - (currpage*regPerPage > totalReg ? currpage*regPerPage - totalReg: 0)} de #{totalReg}"></h:outputText> #Info about, first page row, last page row, total rows.
          </h:panelGrid>
      </ui:fragment>
      
      

       

      Every time i filter or change the list on paged version i use: 

       

      public class Acessorio extends AbstractScrollerBean

      ...

      List<Cadacess> listaobj

      ...

          @Override

          public Integer getRowCount(){

              return listaobj.size();

          }

       

      And thats my scroller data:

       

      public abstract class AbstractScrollerBean implements Serializable {

          private Integer rows = ControladorGen.linhasPorPaginaInicial;

          private Integer scrollerPage = 1;

          private String state;

          private String handleValue;

       

      (with some gets and sets)