7 Replies Latest reply on Feb 23, 2011 7:28 AM by Flávio Henrique

    Richfaces 4 M6: second click in sortable header don´t work

    Flávio Henrique Newbie

      I followed the showcase and now I am able to sort, BUT if I click twice, only the first click is processed. I also find a strange behavior. There are many calls to action="#{meuMB.sortByNome}" when the column header is clicked. I didn´t understand why this method must be void, since JSF action method allways return a String. By the way, I also tried to change this but the problem still occurs. This problem affected all browsers.


      ManagedBean code related to sorting:



      private SortOrder nomeOrder = SortOrder.unsorted;


          public void sortByNome(){

               if (this.nomeOrder.equals(SortOrder.ascending)) {

                this.nomeOrder = SortOrder.descending;

               } else {

                   this.nomeOrder = SortOrder.ascending;





      Page code:


      ?xml version="1.0" encoding="UTF-8" ?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"






      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />




        <rich:dataTable id="tabela" value="#{meuMB.pessoas}" var="pessoa" rows="5"

         noDataLabel="Não há dados" sortMode="single">

         <rich:column id="a1" sortBy="#{pessoa.nome}"


          <f:facet name="header">

           <a4j:commandLink value="Nome" render="tabela"

            action="#{meuMB.sortByNome}" />


          <h:outputText value="#{pessoa.nome}" />



          <f:facet name="header">

           <h:outputLabel value="Idade" />


          <h:outputText value="#{pessoa.idade}" />


         <f:facet name="footer">

          <rich:dataScroller />