Created
August 5, 2014 07:43
-
-
Save jgraglia/63a0ba6b8cbfce2e4ce0 to your computer and use it in GitHub Desktop.
Datatables : save state in html5 local storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datatable = $('#table').dataTable( { | |
"bStateSave": true, | |
// là suite est optionnelle. par défaut cookie, là on utilise localstorage html5 | |
"fnStateSave": function(oSettings, oData) { | |
localStorage.setItem('DataTables_' + this.fnSettings().sTableId, JSON.stringify(oData)); | |
}, | |
"fnStateLoad": function (oSettings) { | |
return JSON.parse(localStorage.getItem('DataTables_' + this.fnSettings().sTableId)); | |
} | |
.... | |
}); | |
// voir http://legacy.datatables.net/ref#bStateSave | |
// voir http://legacy.datatables.net/ref#fnStateSave |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment