Reset the datatables on relogin
Reset the datatables on relogin
Sunil Kumar
Posts: 17Questions: 11Answers: 0
the state of the datatable is getting retained even after user logout and logs in .I have used stateDuration=-1,but still the searched results or sorted results is not getting cleared when user logout.
$("#dataEntryFormTable").dataTable().fnDestroy();
dataEntryFormTable = $("#dataEntryFormTable")
.dataTable(
{
"bProcessing" : false,
"bServerSide" : false,
"stateSave":true,
"stateDuration":-1,
This discussion has been closed.
Answers
stateDuration
set to-1
just usessessionStorage
. For this, you would want to clear the state withstate.clear()
when logging out.Alternatively, you can call that before recreating the table (you would need to destroy it after the clear and initialisation), or just remove the state information by hand, see this recent thread.
Colin
state.clear() is clearing all the rows .i have also used fnDestroy after state.clear().
I want to clear the search results and i want to show the data before search operation was done.
var v1=$("#dataEntryFormTable").dataTable();
v1.fnFilter('');
v1.fnDestroy();
Above code solved my issue.