1 Reply Latest reply on Jun 2, 2009 7:28 AM by jk;l jkl;

    Programmatically access pageIndex from dataScroller

    jk;l jkl; Expert

      I've got a dataScroller whose pageIndexVar attribute is set, say, to myPageIndex. The value is getting set appropriately, because if I output #{myPageIndex} on the page, the current value of the page is displayed.


      However, I haven't been able to access the current page programmatically. If I do a Contexts.lookupInStatefulContexts(myPageIndex) or a getParameterNames()/getAttributeNames() on the HttpServletRequest object, myPageIndex isn't showing up.


      How can I get the value of the current page?

        • 1. Re: Programmatically access pageIndex from dataScroller
          jk;l jkl; Expert

          if I output #{myPageIndex} on the page, the current value of the page is displayed

          Actually, the page index variable will ONLY display when it is displayed within a rich:column of the rich:dataTable associated which contains the rich:datascroller, or in the footer which contains the rich:datascroller. If I try to output the value of the page index anywhere else on the page, it isn't displayed.


          I had a feeling the value is available anywhere on the page but that perhaps it isn't getting updated with the AJAX requests of the datascroller - so I tried the following, which surprisingly didn't work.


          I wrapped the h:outputText which I used to display the page index value in an a4j:outputPanel, whose ajaxRendered attribute is set to true. The reRender of both rich:datascroller and the a4j:form which contains it at a higher level points to the id of the h:outputText and its containing a4j:outputPanel. That doesn't change a thing.


          Why isn't the page index variable available everywhere on the page, and how can I go about fixing this? Thanks.