I'm trying to make sure state of a DataTable is saved in a cookie so when page is reloaded it maintains the sort order of fields. This is my code, but bStateSave seems to be having no effect whatsoever.
I followed the method described here: http://datatables.net/examples/basic_init/state_save.html.
What am I doing wrong? Will appreciate help!
tbl = $(selector).dataTable({
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": dataSource,
"iDeferLoading": totalRecCount,
"sDom": layout ? layout : defaultLayout,
"fnDrawCallback": drawCallback,
"aoColumns": aoColumns,
"oLanguage": {
"sSearch": ""
}
});
Best Answer
OK, I found the answer here: http://datatables.net/forums/discussion/comment/41588
In short it will not work when using iDeferLoading. Will have to maintain that state manually using a cookie which gets created and updated everytime the user sorts or store it elsewhere in the user model.