Nal*_*uri 3 javascript kendo-ui kendo-asp.net-mvc kendo-multiselect
我的应用程序中有多项选择。我有一个要求,我们不应在多选下拉建议列表中显示非活动用户。我们的模型中有旗帜。因此需要知道我们可以使用该标志过滤下拉列表。请找到随附的屏幕截图以获取想法。
我们可以使用该标志过滤 ajax 调用中的数据。但需要获取已选择的非活动用户的名称。所以我试图仅从建议列表中隐藏非活动用户。
不确定这是否是最好的方法,但您可以尝试在open事件中的数据源上应用过滤器并在事件中将其删除close:
$("#multiselect").kendoMultiSelect({
dataSource: {
data: [{Name: "test 1", Active: true, Id: 1},
{Name: "test 2", Active: true, Id: 2},
{Name: "test 3", Active: false, Id: 3},
{Name: "test 4", Active: true, Id: 4},
{Name: "test 5", Active: false, Id: 5}]
},
value: [1, 3],
dataTextField: "Name",
dataValueField: "Id",
filter: "startswith",
open: function(e) {
this.dataSource.filter({ field: "Active", operator: "eq", value: "true" });
},
close: function() {
this.dataSource.filter(null);
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
883 次 |
| 最近记录: |