There are some cases, depending on the code conditions, when one might need to not load the saved state in a particular step. How can we skip the saved state restoration without setting it off?
I found one way, by altering the jquery.dataTables.js. This way I can skip and clear the saved state when I have a predefined column filter which needs to have priority (in aoSearchCols).
[code]
/* start existing code */
function _fnLoadState ( oSettings, oInit )
{
if ( !oSettings.oFeatures.bStateSave )
{
return;
}
/* end existing code */
/* start my code */
for(i in oInit.aoSearchCols){
if(oInit.aoSearchCols[i])
return;
}
/* end my code */
.
.
.
[/code]
Yup - fnStateLoadCallback is what I think you are looking for - http://datatables.net/ref#fnStateLoadCallback . If you don't want to load state, just have that function return false.
Replies
[code]
/* start existing code */
function _fnLoadState ( oSettings, oInit )
{
if ( !oSettings.oFeatures.bStateSave )
{
return;
}
/* end existing code */
/* start my code */
for(i in oInit.aoSearchCols){
if(oInit.aoSearchCols[i])
return;
}
/* end my code */
.
.
.
[/code]
Is there any other way?
Yup - fnStateLoadCallback is what I think you are looking for - http://datatables.net/ref#fnStateLoadCallback . If you don't want to load state, just have that function return false.
Allan