Changing the filter or sorting, while pagination is enabled, does not revert the table back to the first page
Describe the bug When using pagination, after changing a filter or sorting, the tabulator page is not restored to first one. Please note that documentation states otherwise, and this behaviour was working in a previous version.
Tabulator Info 5.1.7
Working Example example of bug: http://tabulator.info/docs/5.1/page example of working version: http://tabulator.info/docs/4.1/page
To Reproduce A step by step guide to recreate the issue:
- Go to http://tabulator.info/docs/5.1/page and move to the very first table (Overview)
- Click on button "2" on the bottom right to move to page two.
- Click on Rating in header to sort by rating
- Page is not restored to the first one.
Expected behavior
Page should be restored to page 1, as the documentation clearly states shortly after in that same page:
Note: Changing the filter, sorting or toggling a groups visibility, while pagination is enabled will revert the table back to the first page.
Desktop:
- OS: Windows 10
- Browser: Google Chrome
- Version: 99.0.4844.74
Compare #3676 these changes .. I am assuming that it might cause problem in other Modules as well
@doublehrajput Unfortunately those changes will result in a reset in horizontal scroll position, which is undesirable when not in paginated mode.
Hey @KarmaProd
Thanks for point out the inconsistency here. As much as this is a regression against the previous version. i think it actually highlights a bigger problem with the current design paradigm.
At the moment scroll positions are preserved when a sort occurs (on local data) but not pagination. which is making the same action trigger different actions per module.
To make things more consistent i will make some improvements in the next update. all modules will maintain their current state on sort/filter and then i will add a sortPositionReset and filterPositionReset (or similar) setup option to allow control over whether this resets the table or not.
Cheers
Oli :)
Actually, I didn't mention something else I noticed. In my stable installation I use tabulator 5.0.7, and this bug is NOT present. But in the http://tabulator.info/docs/5.0/page documentation page the bug IS present. @olifolkerd do you know why?
Because that uses local pagination not remote pagination, the issue isnt about pagination as such but the data source. a remote data source will result in data being reloaded a local source will result in it being refreshed
I am upgrading to 5.2.4. Any update about this small bug?
By now, I am applying this workaround:
treegrid.on("tableBuilt", function(){
// Don't reset page on initial rendering
treegrid.on("dataSorted", function(sorters, rows){
treegrid.setPage(1);
});
treegrid.on("dataFiltered", function(filters, rows){
treegrid.setPage(1);
});
});
I had to do the same as @KarmaProd for workaround. I am using 5.4.
It still shows in its docs: Note: Changing the filter, sorting or toggling a groups visibility, while pagination is enabled will revert the table back to the first page.
@olifolkerd
I am using tabulator 5.4 with remote pagination.
And i am required to keep the page on filter and sort change.
Tabulator5.4 always seems to reset the page back to 1 on filter and sort change.
Is there a corresponding option implemented for sortPositionReset and filterPositionReset?
Or is there a way to maintain the page?
Thank you in advance for your help.