Filtering and sorting on server

I have created a grid and loaded he data using JSON. I trying to do filtering and sorting on the server. So when I click on the header I am calling attachEvent("onBeforeSorting and getting the updated data. But when I click on the filter text box it calls the sorting again. I am using to create filter textbox and attached it using grid.attachHeader(); method.
Is there anything I am doing wrong?
What is the best way to do filtering on server?

Please, try to add the cancelBubble=true for your input.
for example:

Thanks…
It worked…