custom filter not working

Hi,

I have written custom filter for grid. It is working fine with current grid data when i reload grid data (clear and load with different data) that time filter is not working . It is trying to filter with past data where data was cleared. is there anything i need to do for avoiding filter with past data. Please find below details

[code]
suppose grid loads different json data.
json1.json
json2.json
json3.json
First time grid loads json1 data and doing filtering is working fine. getting current grid data
next time clearing grid and loading with json2 data . now filter is not working. getting past grid data (those data cleared) instead of current data.

grid.filterBy(2,function(data){
alert(data.toString());
return true;

});[/code]

Please, provide the sample of your code with your custom filter to suggest you a proper solution.