I have a Kendo Grid in my ASP.NET MVC Web Application. There's filter used on each column. I need to use the value selected from the Filter and save it for maintaining log. How can I access the value upon click of Filter button. I mean that I need to save the value "LPG" upon the click on "Filter" button using client side events for kendo grid or any other way.Please find the screenshot here.
0
votes
1 Answers
3
votes
It is the filter event on the grid. The API documentation is here: https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/events/filter
If you run the dojo for that and open your browser tools, you can see exactly what you need being written to the console. The example given by Telerik is in jquery plugin syntax. If you are using the MVC wrappers to declare the grid, it would be something like this in the grid declaration:
.Events(events => events
.Filter("onFiltering")
)
And a handler something like this:
<script type="text/javascript">
function onFiltering(e) {
if (e.filter == null) {
console.log("filter has been cleared");
} else {
console.log(e.filter.logic);
console.log(e.filter.filters[0].field);
console.log(e.filter.filters[0].operator);
console.log(e.filter.filters[0].value);
}
}
</script>