spiritqueen
spiritqueen

Reputation: 759

Kendo Grid: Clearing filter without calling server side read of data

I have a kendo grid with server side paging. On the same page, I also have a clear button which should clear the data of the grid and replace it with blank rows. Is it possible to clear the filters of that grid, without calling the server side read? Currently when I do this, $("#grid").data("kendoGrid").dataSource.filter({}), it will call the server side function and load the data. Anyone can point me to the right direction? Thanks.

Upvotes: 4

Views: 3984

Answers (1)

gitsitgo
gitsitgo

Reputation: 6769

Despite serverFiltering set to false by default, it seems that filter() automatically calls transport read every single time.

However, you can try this:

dataSource._filter = null;

This will cancel any filters applied to the dataSource without calling transport read. But, you have to be cautious with this approach as it isn't an "official" configuration documented by Telerik. The property _filter is internal, so to speak.

You can verify this works by console logging the requestEnd event and seeing that this doesn't make a request.

Upvotes: 5

Related Questions