1 Reply Latest reply on Mar 7, 2013 7:02 AM by rhanus

    How to show row number information on rich datatable?

    migore

      I'm trying to show the following text on the footer of my table: "Showing 11 to 20 of 51 entries"

       

      But I can't find a way to do it. I didn't find any vars in the footer that give me those variables easily.

      I also tried to create a class that inherits from ExtendedDataModel and kept the values there.

      I got the number of the row from the SequenceRangein the walk method. But, apparently, the footer of the table is rendered before the walk method being called, which resulted that the info on the bottom of my page was outdated by one request.

      Any suggestions on how to do this?

      By the way, I'm using JSF 2.1 and RichFaces 4.3.0 Final.

       

      Here is an example of what I tried to do:

       

      <rich:dataTable >
          <f:facet name="footer" >
              Showing #{bean.dataModel.firstRow} to #{bean.dataModel.lastRow} of #{bean.dataModel.rowCount} entries
              <rich:dataScroller for="transacao-table" maxPages="5" />
          </f:facet>
      </rich:dataTable>
      
      
        • 1. Re: How to show row number information on rich datatable?
          rhanus

          I encountered the same problem and solved it by following facelet snippet:

           

          <a4j:outputPanel id="table" layout="block"

               <rich:extendedDataTable id="theTable"

               ...

               </rich:extendedDataTable>

           

               <a4j:outputPanel id="bottomScroller">

                    <rich:dataScroller for="theTable" maxPages="5" fastControls="hide" page="#{myBean.page}" render="table"/>

                    <h:outputText value="#{myBean.first}/#{myBean.last} of #{myBean.total}"/>

               </a4j:outputPanel>

          </a4j:outputPanel>