Split pagination after certain row with a class

Split pagination after certain row with a class

alexp1234alexp1234 Posts: 2Questions: 1Answers: 0
edited January 2017 in Free community support

I have a table with orders and the products from the orders. I don't have made them with the child option, simple listing, just changing the background color of the <tr>.

The problem is that when I paginate the <tr> with the order title is one page and the products from it are in the next page because the tr is the 25th row and the products are the 26th and 27th row and my display length is 25.

Is there a way to add a class to the <tr> that contains order title for this to be the next row on the next page? Although I have to disable displaylength it will be ok.

Thank you for your time.

Answers

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    No - sorry. DataTables paging has to be equal for every page. You can set it to any number you want, but it can't be 25 for one page, 12 for another and 23 for another, etc (which I think is what you are looking for, but without a test case I'm not certain).

    Allan

  • alexp1234alexp1234 Posts: 2Questions: 1Answers: 0

    But there is a possibility for pagination to count only <tr> with certain class? And when that number is 25, then paginate?

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    edited January 2017

    But there is a possibility for pagination to count only <tr> with certain class? And when that number is 25, then paginate?

    No.
    TBH I think your design is too simplistic and will always give you problems.
    In your shoes I would be looking at the master/detail pattern offered by DataTables' child rows. Alternatively you could look at GROUP BY at the database level.

  • allanallan Posts: 63,839Questions: 1Answers: 10,518 Site admin

    If there are 25 rows for every class, then yes I guess you could make it work. Simply count them before you initialise the DataTable and use the pageLength option to set the page size to be however many rows there are.

    Allan

This discussion has been closed.