I have a Spry filter function which works:
function ffRed(ds, row, index){ var c = row["color"]; return c == 'red' ? row : null; };
Which is toggled by function called from the click handler of a checkbox:
function ToggleFilter(enable, f)
{
if (enable)
ds1.addFilter(f, true);
else
ds1.removeFilter(f, true);
}
Where the check box is onclick="ToggleFilter(this.checked, ffRed);"
I would rather pass a parameter from the checkbox, so I can use the same handler and filter for all the checkboxes and pass which color (e.g. 'red') from the click handler.
I can pass the parameter to the ToggleFilter function no problem, but how to pass it to the filterFunction?
Like this made some sense:
function ffColor(ds, row, index, clr){ var c = row["color"]; return c == clr ? row : null; };
Except this does not do it: ds1.addFilter(f, true, clr)
assuming that clr has been passed the string 'red' from the click handler. That part works, but I am obviously passing it to the filter function wrong.