Using bStateSave with iDeferLoading...
Using bStateSave with iDeferLoading...
ravishbhagdev
Posts: 4Questions: 0Answers: 0
Hi,
I'm trying to get bStateSave working with my table as I want to maintain the sort order for the user when page is refreshed or when user comes back to a page with the table.
According to http://datatables.net/examples/basic_init/state_save.html just adding "bStateSave": true should be enough? But this is not working for me (version 1.9.3). I was wondering if this is because I use iDeferLoading? If yes, how do I get it work if I need to keep iDeferLoading as well? I am only guessing that it is not working because of iDeferLoading so please correct me if wrong.
[code] tbl = $(selector).dataTable({
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": dataSource,
"iDeferLoading": totalRecCount,
"sDom": layout ? layout : defaultLayout,
"fnDrawCallback": drawCallback,
"aoColumns": aoColumns,
"oLanguage": {
"sSearch": ""
}
});
[/code]
Thanks for a great library btw!
Rav
I'm trying to get bStateSave working with my table as I want to maintain the sort order for the user when page is refreshed or when user comes back to a page with the table.
According to http://datatables.net/examples/basic_init/state_save.html just adding "bStateSave": true should be enough? But this is not working for me (version 1.9.3). I was wondering if this is because I use iDeferLoading? If yes, how do I get it work if I need to keep iDeferLoading as well? I am only guessing that it is not working because of iDeferLoading so please correct me if wrong.
[code] tbl = $(selector).dataTable({
"bStateSave": true,
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": dataSource,
"iDeferLoading": totalRecCount,
"sDom": layout ? layout : defaultLayout,
"fnDrawCallback": drawCallback,
"aoColumns": aoColumns,
"oLanguage": {
"sSearch": ""
}
});
[/code]
Thanks for a great library btw!
Rav
This discussion has been closed.
Replies
The reason they won't work together is that deferred loading means that the data from the HTML table is read for the first draw and shown, loading only on sort, filter, page - but that data in the HTML is unlikely to be the data for the saved state - hence why it is broken.
Note made to disable deferred loading in this situation :-)
Allan
Thanks Allan.