以下代码段使用MultiSelect字段筛选项目数组。仅在MultiSelect中选择了项目并单击“过滤器”按钮时才会进行过滤。 http://jsbin.com/iVIQoKiV/1/edit
如何使用DropDownList进行设置?此外,一旦在DropDownList中选择了一个项目,如何在不需要单击按钮的情况下立即过滤网格?
修改
这是一个新的JSBin。管理实现DropDownList。我使用了以下更改事件,但现在过滤不起作用:
change: function() {
var value = dropdown.value();
if (value) {
grid.data("kendoGrid").dataSource.filter({
field: "Territories",
operator: function (itemValue) {
var matchingItem = itemValue.find(function (item) {
return $.inArray(item.TerritoryID, value) >= 0;
});
return matchingItem !== null;
}
});
}