omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
251 stars 113 forks source link

Changing the page manually (using page() for example) doesn't work. #217

Closed olvenmage closed 3 years ago

olvenmage commented 3 years ago

When I try to use Datatables native page() function, it doesn't work.

This is the code I'm using (purely as a test):

$(...).initDataTables(options).then((dt) => {
      dt.page(3).draw(true);
});

If I log dt.page.info() it does say that the page has been updated to 3, but the omines bundle doesn't seem to use that value.. It does draw, but neither the results nor the pagination updates to page 3.

I've tried draw(true), draw(false), draw('page'), nothing works. Is there something I'm doing wrong or an alternative way to manually set the pagination page?

olvenmage commented 3 years ago

It seems that it matters when you call this function, I ran it while another draw was running which caused my draw('page') not to do anything, calling it afterwards fixed this issue