Ronny Linsener
Ronny Linsener

Reputation: 253

Avoid jquery datatables changing pagination on site reload

For big tables I use jquery data tables. For example The pagination is on page 4 and with a reload of the site (because of a sent form) the pagination jumps automatically to the first pagination site.

Is there a possibility to avoid this behaviour?

Upvotes: 1

Views: 1342

Answers (3)

Webezine
Webezine

Reputation: 456

Alternatively if your doign a draw or invalidate jsut pass false and the pagination will remain IE:

table.cell( this ).invalidate().draw(false);

Upvotes: 0

davidkonrad
davidkonrad

Reputation: 85518

Use the stateSave option. Basic usage (dataTables 1.10.x) :

var table = $('#example').DataTable({
    stateSave: true
});

demo -> http://jsfiddle.net/cayb99cq/

Select a page, then right click in the frame where the datatable is (the lower right frame) and select "reload frame".

Upvotes: 1

Sunil Goli
Sunil Goli

Reputation: 459

You can post the pagination value (ie page number or limit an offset) with the form itself and retrieve data for the data table for that pagination value.

OR

Submit form using AJAX (ie dynamic) and reload only that div

Upvotes: 0

Related Questions