SearchPanes, How to mantain current page after rebuildPane is used?
SearchPanes, How to mantain current page after rebuildPane is used?

Whenever I rebuild the search panes the main table goes to the first page... even with stateSave set to true
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
@colin Hello Colin, I made a live test case:
live.datatables.net/nucaqele/1/edit?html,js,output
In there if you go to any page and then rebuild one pane or any # of them, you'll get back to page 1
I'm pretty sure that there are workarounds like getting the current page before rebuilding the pane, and then going to that page... but I wonder if that is the intended behavior and if there is an option or something I'm missing to not get back to page 1 after pane/s rebuild
Thanks Collin
Hi @Dreaker ,
You can just note the page before you call
searchPanes.rebuildPane()
and then usepage()
to set it after. Take a look at this example.Thanks,
Sandy
Hi @Dreaker ,
Colin has just pointed out to me that there is a mistake in the above example. You should also pass
false
intodraw()
so that the paging does not reset. See this updated example.Thanks,
Sandy
Thanks to you both!
@sandy I got another question related to this issue, if I'm using scroller how would I go about maintaining current scroll position after pane rebuild? Should I post a different question with a test case? Because in scroller after pane rebuild it always goes to the top of the table
There's not a built in way to make that scroll, so you would need to either use
scroller.toPosition()
orrow().scrollTo()
in a similar way that Sandy did with the paging functions in the other example.Colin
Thanks, I did that, but had to use promises or async in order to make it worth properly because when the dataset is huge, the paneRebuild takes a lot of time and the toPosition() method is executed before the paneRebuild
But it worked at the end...
Thanks Colin for the quick reply