Reputation: 6461
When my server-side processing datatable is loaded the header is broken. To resolve this, I added table.columns.adjust().draw()
to my initComplete function:
var table = $('.table').DataTable({
"serverSide": true,
/// more code...
"initComplete": function(settings, json) {
table.columns.adjust().draw();
}
});
This works, but it affected the pagination. The correct page is not displayed anymore. It is set back to to first page. How can I prevent this?
Upvotes: 2
Views: 4407
Reputation: 73896
For DataTables version > 1.10.x, you can simply pass false
to draw()
api which will redraw the table but maintaining current paging position like:
table.columns.adjust().draw( false );
As mentioned in the docs:
paging
false
Upvotes: 2