I want to clear, for example, the filter array in my grid:
$(
'table#user_org_table'
).data(
'kendoGrid'
).dataSource.filter({});
Filter is cleared, but after this .filter() function, my grid is automatically refreshed.
How to clear filter, sorting and paging with 1 time grid refreshing?
Thanks.
8 Answers, 1 is accepted
// Clear filter/sort/page
$(
'table#user_org_table'
)
.data(
'kendoGrid'
).
dataSource.query({
page: 1,
pageSize: 20,
sort: {
field: "SomeField",
dir: "asc"
},
filter: [
{ field:
"Search"
, value:
""
},
{ field:
"Status"
, value:
""
}
]
});
Hi Pavlik's
Did you get this working? Its not working for me when i passed empty arrays to sort and filter to clear all at a time.
The filter and sort object could not contain an empty array, but if they are missing, the current expressions should be removed:
$("#grid").getKendoGrid().dataSource.query({page:1, pageSize: 20})
The above should clear all expression and should leave only the applied paging.
Regards,
Konstantin Dikov
Telerik by Progress
I tried your Code but thats not working as expected.
It is throwing error with empty sort and filter in the URL. please find attached Image.
Below is my code.
//clear grouping, sorting, filtering
var datasource = $('#FacilityGrid').data('kendoGrid').dataSource;
datasource.sort([])
datasource.filter([])
datasource.group([])
This works as expected but it is making three calls to controller. I want to clear all at a time.
With your Query $("#FacilityGrid").getKendoGrid().dataSource.query({ page: 1 }); it is throwing error.
Hello Raj,
Please try to send the pageSize in the query method in order to work as expected.
Regards,Boyan Dimitrov
Telerik by Progress
Thanks for the fix. It works as expected.
But The number of records on footer are showing as NaN after executing that query.
please find attached image. How to fix that. I am using virtual scrolling.
Thanks
Raj.
Could you please create a dojo example demonstrating the issue, so we could inspect it locally:
Looking forward to your reply.
Regards,
Konstantin Dikov
Telerik by Progress