Reputation: 4275
Can I catch an event fired by filter event? With this way, Can I take a returned row/rows after filtering?
Upvotes: 6
Views: 17647
Reputation: 1417
Jaroslaw's answer didn't work for me. I was trying to select the first record on a kendo grid after filter.
I've solved this by binding to the data bound event of the grid.
$("#grid").kendoGrid({
columns: [
{ field: "name" },
{ field: "age" }
],
dataSource: [
{ name: "Jane Doe", age: 30 },
{ name: "John Doe", age: 33 }
],
dataBound: function(e) {
//your databound event here
}
});
Additionally, you could use the view method in order to get the displayed results after filtering.
Upvotes: 0
Reputation: 3407
Like Kendo say in API reference: "The change event of the dataSource is fired when the data source is populated from a JavaScript array or a remote service, a data item is inserted, updated or removed, the data items are paged, sorted, filtered or grouped."
Anyway you can't detect if that was filter or other event of type "read" fired. If you need it, you have to check the filter configuration in grid dataSource for any changes.
Returned rows are in the items property of the change function argument. Code:
$("#grid").kendoGrid({
dataSource: {
change: function(e) {console.log(e.items);},
},
Example: http://dojo.telerik.com/iPEko
API Reference for dataSource change event.
API Reference for dataSource filter method.
Upvotes: 5