2 Replies Latest reply on Feb 11, 2009 9:09 PM by Flavio Henrique

    How to put sortBy and filterMethod work together in dataTabl

    Flavio Henrique Newbie

      Hi there!
      I was using r:dataTable with sortBy attribute and working fine.

      After inserting filterMethod I got some problems because when I click on textField to filter the column, the event to sort get fired and I can't type noghing.

      The demo site demonstrate these two functions together only using r:extendedDataTable, so I'm not sure if is possible to use r:dataTable.

      Someone can cast a light here, please?

      Thank you in advance!

      I'm using:
      Richfaces 3.2.2
      JSF 1.2

      My code:

      <r:dataTable
       value="#{ManterPessoa.lista}"
       var="item"
       sortMode="single"
       id="table"
       rows="10"
       width="680"
       style="heigth: 720px;"
       align="center">
       <f:facet name="header">
       <r:columnGroup>
       <r:column colspan="3">
       <h:outputText value="Registros encontrados" />
       </r:column>
       <r:column breakBefore="true">
       <h:outputText value="" />
       </r:column>
       <r:column>
       <h:outputText value="Matricula" />
       </r:column>
       <r:column>
       <h:outputText value="Nome" />
       </r:column>
       </r:columnGroup>
       </f:facet>
       <r:column
       width="10%"
       style="text-align:center;">
       <f:facet name="header">
       <h:outputText value="" />
       </f:facet>
       <a4j:commandLink
       reRender="#{paramReRender}"
       oncomplete="Richfaces.hideModalPanel('modalPessoas');"
       style="text-decoration: none; border: none">
       <h:graphicImage
       value="/imagens/selecionar.png"
       style="text-decoration: none; border: none"
       title="selecionar registro" />
       </a4j:commandLink>
       </r:column>
       <r:column
       sortBy="#{item.matricula}"
       filterMethod="#{ManterPessoa.filterPessoaMatricula}"
       width="20%"
       style="text-align:center;">
       <f:facet name="header">
       <h:inputText
       value="#{ManterPessoa.filterValueMatricula}"
       id="inputMatricula">
       <a4j:support
       event="onkeyup"
       reRender="table , ds"
       ignoreDupResponses="true"
       requestDelay="700"
       oncomplete="setCaretToEnd(event);" />
       </h:inputText>
       </f:facet>
       <h:outputText value="#{item.matricula}" />
       </r:column>
       <r:column
       sortBy="#{item.nome}"
       width="70%"
       filterMethod="#{ManterPessoa.filterPessoaNome}">
       <f:facet name="header">
       <h:inputText
       value="#{ManterPessoa.filterValueNome}"
       id="inputNome">
       <a4j:support
       event="onkeyup"
       reRender="table , ds"
       ignoreDupResponses="true"
       requestDelay="700"
       oncomplete="setCaretToEnd(event);" />
       </h:inputText>
       </f:facet>
       <h:outputText value="#{item.nome}" />
       </r:column>
      </r:dataTable>