1161 0 0 0
Last Updated : 2025-04-28 23:54:53
When using datatables and made a filter, then navigated a way from the current page for editing or somthing like this as went back to find out that the filteration you have done already is gone, if you want to preserve this state when you comeback, the solution is simple in datatable like this:
Here is the main implementation of the datatables in mycase:
$("#itemsTable").DataTable({
processing: true,
serverMethod: 'get',
ajax: {
url: "{{ url('admin/bills') }}"
},
columns: myJSON
});
Now, we need to add this : serverSide: true, so that the code becomes :
$("#itemsTable").DataTable({
processing: true,
serverMethod: 'get',
stateSave: true, //This will reserve the state when you come back to the same page again
ajax: {
url: "{{ url('admin/bills') }}"
},
columns: myJSON
});
That's it ?