Skip to content

Instantly share code, notes, and snippets.

@stevelippert
Created February 17, 2014 23:24
Show Gist options
  • Select an option

  • Save stevelippert/9061347 to your computer and use it in GitHub Desktop.

Select an option

Save stevelippert/9061347 to your computer and use it in GitHub Desktop.
Advanced DataTables Initialization
var workloadTable = $(".dataTables").dataTable({
"sDom" : '<"top"plf<"workload_filter"><"clear">>rt<"bottom"ipl<"clear">>',
"aaSorting" : [[ 5, "desc" ]],
"aoColumns" : [
{ "sWidth": "250px" },
{ "sWidth": "144px", "sType":"title-string" },
{ "sWidth": "300px" },
{ "sWidth": "125px" },
{ "sWidth": "150px" },
{ "sWidth": "150px" },
],
"oLanguage" : {
"sEmptyTable" : "There are no workload events",
"sLengthMenu" : "Show: _MENU_",
"sSearch" : "Filter:",
"sZeroRecords": "There are no workload events"
},
"bAutoWidth" : false,
"bStateSave" : true,
"fnStateSave" : function (oSettings, oData){
localStorage.setItem( 'DataTables_'+window.location.pathname, JSON.stringify(oData) );
},
"fnStateLoad" : function (oSettings){
return JSON.parse( localStorage.getItem('DataTables_'+window.location.pathname) );
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment