0 Replies Latest reply on Feb 10, 2012 8:02 AM by Rodrigo Uchoa

    rich:dataTable with dynamic number of rows - richfaces 3.3.1.GA

    Rodrigo Uchoa Novice

      Hey guys,

       

          I've been trying do to something that at first glance appeared to be simple: I wanted to have a <h:selectOneMenu> on which the user can select the number of rows of a dataTable he wants to see. And he can change that number anytime (the <h:selectOneMenu> is right at the footer of the dataTable).

       

         So I started with the basics:  I have an <a4j:support> on the selectOneMenu, triggered by an onchange event. That event updates a Seam variable, that is also bound to the dataTable's rows attribute:

       

       

      <rich:dataTable id="myDataTable" value="#{dataModel}" rows="#{numberOfRows}" var="_obj"  >
      

       

       

      And the selectOneMenu:

       

      <h:selectOneMenu value="#{numberOfRows}">
           <f:selectItem itemLabel="10" itemValue="10" noSelectionOption="true"/>
           <f:selectItem itemLabel="50" itemValue="50" />
           <f:selectItem itemLabel="100" itemValue="100"/>
           <f:selectItem itemLabel="150" itemValue="150"/>
           <f:selectItem itemLabel="200" itemValue="200"/>        
           <f:convertNumber/>
           <a4j:support ajaxSingle="true"                        
                              event="onchange" 
                              reRender="myDataTable" />
      </h:selectOneMenu>
      

       

       

       

      The whole thing relies on the "numberOfRows" variable. So the end result is that its not working. The datascroller even changes accordingly showing the right number of pages that should be left, but the number of rows doesn't change. I even tried wrapping the dataTable around an <a4j:outputPanel> and make the a4j:support re-render the panel, but the result was pretty much the same. Only the datascroller seems to get affected, not the whole dataTable.

       

      What am I missing?