3 Replies Latest reply on Jun 9, 2009 12:50 PM by Tanya Ruttenberg

    Datascroller works with a4j:repeat ?

    Tanya Ruttenberg Expert

      I would like to use datascroller with a4j:repeat component, but so far I cannot get it to work.

      My app is a seam application and my action bean implements EntityQuery.

      My table is quite complex, too complex for a simple dataTable. Instead I have 3 dataTables nested within the a4j:repeat. I played with this extensively and could not get the result I wanted simply with 1 dataTable, even with a subTable.

      The basic outline of my code is this:

      <rich:datascroller for="officeViewTable" rows="10" />
      <a4j:repeat value="#{officeViewList.resultList}" var="_officeView" id="officeViewTable" >
       <rich:dataTable var="_ov1" value="#{_officeView}">
      
       .... details deleted....
      
       </rich:dataTable>
       <rich:dataTable var="_ov2" value="#{_officeView}"
       columns="1">
      
       .... details deleted....
      
       </rich:dataTable>
      
       <rich:dataTable value="#{_officeView.devices}" var="_devices" styleClass="device-table">
      
       .... details deleted....
      
       </rich:dataTable>
      
      </a4j:repeat>


      The datascroller I get is just a blank, empty shell of a datascroller that doesn't do anything when you click it.

      Should it work with a4j:repeat? How do I get it to work?

      tdr

        • 1. Re: Datascroller works with a4j:repeat ?
          Ilya Shaikovsky Master

          1) define rows attribute for repeat not for datascroller.
          2) add reRender to datascroller and taking into consideration that repeat itself - has no representation int DOM wrap it into outputPanel and reRender outputPanel from datascroller.

          • 2. Re: Datascroller works with a4j:repeat ?
            Tanya Ruttenberg Expert

            I think I understand what you are suggesting. This code sort of worked:

            <rich:datascroller for="officeViewTable" reRender="officeViewTable" />
             <a4j:outputPanel>
             <a4j:repeat value="#{officeViewList.resultList}" var="_officeView"
             rows="10" id="officeViewTable">
             <rich:dataTable var="_ov1" value="#{_officeView}" />
             <rich:dataTable var="_ov1" value="#{_officeView}" />
             <rich:dataTable var="_ov1" value="#{_officeView}" />
             </a4j:repeat>
             </a4j:outputPanel>
            


            (there are 3 separate dataTables embedded in this repeat component)

            Now the datascroller seems to render correctly. I got the correct number of datascroller panels (ie they correspond to the number of repeat components)

            The problem now is that clicking through the datascroller doesn't change the contents of the table on that page. In other words, the first record is Office ID 5164 whether I click on the first page of the datascroller, the 3rd or the 10th.

            I barely grasp this Ajax stuff -- what, again, am I missing?

            TDR

            • 3. Re: Datascroller works with a4j:repeat ?
              Tanya Ruttenberg Expert

              BTW outputPanel doesn't seem to add anything so I took it out. the reRender target for datascroller has to be a UIData component. An outputPanel component didn't work.

              TDR