Reputation: 2329
I have datagrid with filters, but in addition to those i want to add dropdownlist with ready data items to filter by, how to do it in kendoway? How to POST category name to server with picked value?
$("#category_list").kendoDropDownList({
dataTextField: "name",
dataValueField: "id",
dataSource: {
transport: {
read: {
url: '/api/notes/cats',
dataType: 'json',
type: 'GET',
},
},
schema: {
data: function(reply) {
return reply.rows
},
}
},
change: function() {
val = $("#category_list").val();
}
})
Upvotes: 3
Views: 1873
Reputation: 43718
If I am reading your question correctly, then you want your DropDownList to have pre-made filters that get applied to your Grid?
In the click
event of your DropDown, you can get the Grid's DataSource
and apply a filter to it using the .filter()
function.
Something like:
$("#category_list").kendoDropDownList({
change: function() {
var grid = $("#my_grid").data().kendoGrid;
var filters = grid.dataSource.filters;
// modify filters as needed
grid.dataSource.filter(filters);
}
});
Upvotes: 3