9 Replies Latest reply on Jul 21, 2009 8:50 AM by ilya_shaikovsky

    rich:dataScroller - how to make true pagination?

    vhmolinar

      Hello guys, i want to know how can i make a true pagination binding the component rich:dataScroller to hibernate query methods maxResults and firstResults for create a true pagination, cause actually rich:dataScroller ever make the full search on my dataBase.

      It is possible?

        • 1. Re: rich:dataScroller - how to make true pagination?
          israel.bgf

          It's possible to achive this with some code (a lot of code actualy). Here in my work we have 4 classes, even a new List implementation to achieve the "true pagination" with the help of the data-scroller component. I dont think that have something straight-forward but i think that it would be VERY nice to see.

          • 2. Re: rich:dataScroller - how to make true pagination?
            vhmolinar

             

            It's possible to achive this with some code (a lot of code actualy). Here in my work we have 4 classes, even a new List implementation to achieve the "true pagination" with the help of the data-scroller component. I dont think that have something straight-forward but i think that it would be VERY nice to see.


            Could you share these source code?

            PS: RichFaces should provide it without external code. :(

            • 3. Re: rich:dataScroller - how to make true pagination?
              israel.bgf

              yes i can, but its a bit useless without explaining it a little. Maybe tomorrow i post it here (busy day :)).

              • 4. Re: rich:dataScroller - how to make true pagination?
                ilya_shaikovsky

                vhmolinar,

                1) two demos available at richfaces-demo where you could see true paggination works properly
                2) RichFaces can't handle it internally and really it should not. Because we are not responsible for your model creation and initialization

                • 5. Re: rich:dataScroller - how to make true pagination?
                  vhmolinar

                  I've tried to follow the descriptions of those rich-dataScroller attributes in (http://www.jboss.org/file-access/default/members/jbossrichfaces/freezone/docs/devguide/en/html/rich_datascroller.html) and I've recognized that I need to know how can I notify the dataScroller component about how many pages that might be rendered on dataTable and I've tried two of those attributes to make it work out:

                  'pagesVar' and 'fastStep'.

                  Their descriptions:

                  PagesVar: "Name of variable in request scope containing number of pages"
                  FastStep: "The attribute indicates pages quantity to switch onto when fast scrolling is used. Default value is "0"."

                  And then I've got a bad fail, cause both of them hasn't worked out.
                  So how can I notify the dataScroller component about how many pages might be rendered on dataTable based on something like that:

                  Select Count(1) From (table-name)


                  Think that, if my attribute rows of rich:dataTable is setted to '10' and then the query result is something about '200', so rich:dataScroller can only show 20 link pages.

                  Please guys, how can i make it?

                  • 6. Re: rich:dataScroller - how to make true pagination?
                    nbelaevski

                    There's maxPages attribute.

                    • 7. Re: rich:dataScroller - how to make true pagination?
                      vhmolinar

                      maxPages only set the maximum quantity of VISIBLE LINKS on dataScroller.
                      I want to append a number of links that the user might search.

                      For example on my dataTable I want to show my complete query result, that is something about 10 rows(the full query result), but I have also to show on dataScroller the total pages that can be searched on dataTable.

                      This total pages is calculated by the total number of rows in my table divided by the quantity of rows rendered by search(row attribute of my dataTable).

                      Imagine that these numbers bellow are my dataScroller and they are setted by this total pages.

                      1 - 2 - 3 - 4 - 5

                      When I load my page, the search made by my hibernate DAO is supposed to have these attributes:

                      .firstResult(0)
                      .maxResult(10)

                      Where only the result of the query will be load to application memory

                      And when I click on link number '2', the search made is supposed to have these values on attributes showed bellow:

                      .firstResult(10)
                      .maxResult(10)


                      See that I only want to show the result by page, but I need to especific the number of pages.

                      What attribute of dataScroller solve this one?

                      I've tried pagesVar and fastStep.

                      • 8. Re: rich:dataScroller - how to make true pagination?
                        vhmolinar

                        Ps: I'm using seam, where I use the @Factory annotation on my method that loads my result query list.

                        • 9. Re: rich:dataScroller - how to make true pagination?
                          ilya_shaikovsky

                          have you checked the sample with model with hibernate using at richfaces-demo?