How to save a custom filter?
How to save a custom filter?
paupiette
Posts: 2Questions: 1Answers: 1
I have added a custom filter, to filter some rows when an input is checked or not:
$.fn.dataTableExt.afnFiltering.push(
function( p_Settings, p_Data, p_DataIndex )
{
var l_Checked = $("#onlyRedRows").prop("checked");
var l_Row = p_Settings.aoData[p_DataIndex].nTr;
var l_IsRed = $(l_Row).attr("data-isRed");
if(l_Checked)
{
if(l_IsRed == "true")
{
return true;
}
return false;
}
return true;
}
);
It works fine.
Now I would like to save this filter in the cookie thanks to the option stateSave.
I don't know how to do it... I tried to use the options fnStateSaveParams, fnStateLoadParams. But I can't figure it out. Anybody has an example please?
This discussion has been closed.