Restart pagination without calling draw() (server side)

Restart pagination without calling draw() (server side)

martamarta Posts: 5Questions: 2Answers: 1

Hi,

I have a server-side DataTable. I would like to avoid calling draw() just to reset the pagination when the data changes (calling draw() means that ajax will be executed twice). So I decided to check if pagination reset is needed (meaning the user does a new search and new data should be displayed) and destroy the DataTable and recreate it passing d.start = 0 to data in the ajax call. But the pagination is still off. It will show for instance:

Showing 4,271 to 6 of 6 entries

if the user was at 4271st record in the previous search, even though we have only 6 records to display.

The reason for that behaviour seems to be DataTables localStorage which keeps start: 4270 for that page. Is there any way to override localStorage start value without calling draw() and without tweaking localStorage manually, of course?

I hope I'm making myself clear, let me know if you need more info.

Many thanks (and many thanks for a great library),
Marta

This discussion has been closed.