1 Reply Latest reply on Nov 21, 2012 7:46 AM by Misha Stankovic

    rich:dataTable builtin sort does not work

    mabu2 Newbie



      I would like to have a table with 2 columns, the first colum should be sortable. So I wrote this xhtml:


      <!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"







          <link href="styles/styles.css" rel="stylesheet" type="text/css" />



          <f:loadBundle basename="afs.message" var="msg" />


          <rich:dataTable value="#{userBean.allUserItems}" var="userentry" id="usertable" style="height:300px; width:300px;">

              <rich:column sortable="true" sortBy="#{userentry.fullName}">

                  <f:facet name="header">

                      <h:outputText value="#{msg.lbl_name}" />


                  <h:outputText value="#{userentry.fullName}" />



                  <f:facet name="header">

                      <h:outputText value="#{msg.lbl_id}" />


                  <h:outputText value="#{userentry.id}" />






      This works well except the sort feature. Nothing happens when I click on the column header. The generated html is this:



        <table id="usertable" class="rf-dt" style="height:300px; width:300px;">

           <colgroup span="2"></colgroup>

              <thead id="usertable:th" class="rf-dt-thd">

                <tr id="usertable:ch" class="rf-dt-shdr">

                           <th class="rf-dt-shdr-c" scope="col" id="usertable:j_idt22">Name</th>

                  <th class="rf-dt-shdr-c" scope="col" id="usertable:j_idt9">ID</th>




      So it is clear, that nothing happens, because there is no onclick attribute or any other element which could react to a mouse click. But why?


      My environment:

      • Tomcat 7.0.28 Java with JRE 1.6.0_30
      • Eclipse Indigo


      Thanks in advance


        • 1. Re: rich:dataTable builtin sort does not work
          Misha Stankovic Newbie

          I have the same problem with RichFaces 4.2.3-Final running on Tomcat 7 and Mojarra 2.1.14.

          The data is displayed OK, but no sorting links in the header nor in the generated HTML.

          My xhtml is as below: 



          <rich:dataTable value="#{propertySearch.properties}" var="property">

               <rich:column sortBy="#{property.id}" Sorted="true">

                    <f:facet name="header">ID</f:facet>

                    <h:outputText value="#{property.id}" />


              <rich:column sortBy="#{property.propertyType}">

                    <f:facet name="header">Property Type</f:facet>

                    <h:outputText value="#{property.propertyType}" /></rich:dataTable>




          Does anyone have sorting working in this version of RichFaces?