Reputation: 59
I want to do is save the current contents of the datatable using localstorage before the browser is closed or refreshed by the user.
I looked in the datatable examples http://datatables.net/beta/1.9/examples/advanced_init/localstorage.html and i tried the code but it doesn't work.
My problem is in my current code it doesn't work if i refresh the page or closed it and open again the current content before i closed or refreshed the page the content is gone.
current code: http://jsfiddle.net/4GP2h/18/
$(document).ready(function() {
$('#myTable').dataTable( {
"bStateSave": true
} );
} );
Upvotes: 0
Views: 52
Reputation: 2551
The dataTable
will not store the datatable content in the localStorage
instead it stores the state of the dataTable such as pagination position, display length, filtering and sorting.
Enable or disable state saving. When enabled aDataTables will storage state information such as pagination position, display length, filtering and sorting. When the end user reloads the page the table's state will be altered to match what they had previously set up.
For more information please refer this link.
Upvotes: 2