Skip to content

Commit

Permalink
Save table state (issue #22)
Browse files Browse the repository at this point in the history
Use local storage to save table state (without saving start page)
  • Loading branch information
rap2hpoutre committed Apr 10, 2015
1 parent dbd405d commit cd44c3f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/views/log.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,20 @@
<script>
$(document).ready(function(){
$('#table-log').DataTable({
"order": [ 1, 'desc' ]
"order": [ 1, 'desc' ],
"stateSave": true,
"stateSaveCallback": function (settings, data) {
window.localStorage.setItem("datatable", JSON.stringify(data));
},
"stateLoadCallback": function (settings) {
var data = JSON.parse(window.localStorage.getItem("datatable"));
data.start = 0;
return data;
}
});
$('.table-container').on('click', '.expand', function(){
$('#' + $(this).data('display')).toggle();
});
});
</script>
</body>
Expand Down

0 comments on commit cd44c3f

Please sign in to comment.