我有带过滤器的数据网格,但除了那些我想添加下拉列表 准备好要过滤的数据项,如何在 kendoway 中进行过滤? 如何使用选择的值将类别名称发布到服务器?
$("#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();
}
})
最佳答案
如果我没看错您的问题,那么您希望您的 DropDownList 具有应用于您的网格的预制过滤器吗?
在 DropDown 的 click
事件中,您可以获得 Grid 的 DataSource
并使用 .filter()
对其应用过滤器功能。
类似于:
$("#category_list").kendoDropDownList({
change: function() {
var grid = $("#my_grid").data().kendoGrid;
var filters = grid.dataSource.filters;
// modify filters as needed
grid.dataSource.filter(filters);
}
});
关于ajax - Kendo UI DropDownList 服务器过滤,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14125031/