Problem with a pagination.

Problem with a pagination.

lankmilerlankmiler Posts: 5Questions: 1Answers: 0
edited April 2018 in Free community support

Hello there.
I have one problem with a pagination. When some of items are hidden - it calculates it and creates a "page" for it. Is there a way to fix it? I want to make right pagination for it and i'll have a functionality for it - checkbox that will hide/show items on change, but with "calculating" pagination.

https://jsfiddle.net/sy1wkyv4/1/

Answers

  • lankmilerlankmiler Posts: 5Questions: 1Answers: 0

    or maybe it's wrong way to do it...
    Anyway - i want to do this feature, so i'll be very grateful for help with it

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    No - DataTables will not take account of display: none on an HTML tr element.

    If you want to remove items from the page, search is how you do it in DataTables. You can create your own plug-ins if you need to apply a logic condition to each row.

    Allan

  • lankmilerlankmiler Posts: 5Questions: 1Answers: 0

    One element is hidden and it makes one page more. When it must be 2 here. You can see it at shared link.

    So there is no available functions to do those actions? I want just hide them and show after. But with right pagination

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    No, as I mentioned above DataTables will not take account of display: none rows.

    Allan

  • lankmilerlankmiler Posts: 5Questions: 1Answers: 0

    So why there is 3 pages when it must be 2. 2 items per page, 5 in total but 1 is hidden. It must be 3 if that 1 will be shown. But id wasn't

  • lankmilerlankmiler Posts: 5Questions: 1Answers: 0

    And it writes "Showing 1 to 2 of 5 entries". When it's 4 in total(without hidden) and it's one element at page, not 2

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    Because DataTables counts the hidden row. Even if it isn't actually visible on the page (because you've hidden it!) there is still a node there and DataTables still counts it.

    As I said before, DataTables does not take account of the display: none rows.

This discussion has been closed.