Responsive plugin paging broken in bootstrap modal

Responsive plugin paging broken in bootstrap modal

johnbuckjohnbuck Posts: 2Questions: 1Answers: 0

When I load a simple table in a bootstrap modal and use responsive, paging is broken. you cannot get to the LAST page.
not sure what is happening. anyone have a idea?

http://jsfiddle.net/6fsq0rat/5/

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    The problem is because your ResizeObserver function is called on every draw, even when changing page, and that contains a call draw() which will reset to the first page.

    Changing the code to this works:

    var roul = new ResizeObserver(entries => {
      for (let entry of entries) {
        $('#example').DataTable().columns.adjust().responsive.recalc().responsive.rebuild().draw(false);
      }
    });
    

    Colin

  • johnbuckjohnbuck Posts: 2Questions: 1Answers: 0

    Thankyou.

    Changing it to $('#example').DataTable().responsive.recalc();

    fixed the issue.

    The Paging to the last page triggered the resize observer because the table switched size on the last page because it was only a few rows. which in my code caused it to rebuild from page 1.

This discussion has been closed.