Pagination based on row grouping

Pagination based on row grouping

rogermrogerm Posts: 1Questions: 0Answers: 0
edited December 2009 in Plug-ins
I have used the DataTables Row Grouping Example (http://datatables.net/examples/advanced_init/row_grouping.html) to add a group total row at the bottom of each group of rows. When I set pagination page size high enough to see all rows, everything works fine. When I change to a lower pagination page size, I would like to use the pagination page size as a guideline only and set the page size so that only complete groups of rows are in each page. This way each group total row is immediately below all of the rows for the group. With the normal, fixed pagination, I end up with some groups of rows spanning pages and thus the group total rows may be misleading.

I have browsed the forum "pagination" topics and have not seen a solution to this particular pagination enhancement. I am looking for ideas on how to implement this is a manner that would not conflict with future releases of DataTables. Any help would be appreciated.

Roger

Replies

  • allanallan Posts: 61,716Questions: 1Answers: 10,108 Site admin
    Hi Roger,

    Interesting one. DataTables treats the pagination length as absolute, rather than flexible as you want. But it might be possible to do what you are looking for - if you use fnDrawCallback, you will be able to look at the nodes and see how many more rows need to be displayed. Then you just modify the display length ( oSettings._iDisplayLength ) and redraw the table to display all of the rows you want to show.

    Hope this helps,
    Allan
This discussion has been closed.