[英]How to filter data for a nested Kendo UI datasource in Hierarchy grid
[英]How to filter already filtered datasource in Kendo grid
在我的應用程序中,我使用劍道網格,我使用kendoDropDownList
過濾數據源,如下所示,
<div class="pull-right">
<label>Select Value</label>
<select class="form-control" id="selectGroup">
<option selected="selected">Group A</option>
<option>Group B</option>
<option>All</option>
</select>
</div>
我如何調用 JS
$('#selectGroup').kendoDropDownList({
autoBind: false,
change: function (e) {
var grid = $('#allUsersGrid').data('kendoGrid');
var field = 'Group';
var operator = 'eq';
var value = e.sender.value();
if (value == "Group A" || value == "Group A") {
value = e.sender.value() == "Group A" ? true : false;
grid.dataSource.filter({
field: field,
operator: operator,
value: value
});
} else {
grid.dataSource.filter([]);
}
}
});
上面的代碼工作正常,現在我需要從上面的filtered
結果中搜索值。 我該怎么做?
我寫的搜索功能如下
function SearchProductServices() {
var grid = $("#allUsersGrid").data("kendoGrid");
var field = 'MemberName';
var operator = 'contains';
var value = $("#txtSearchSearch").val();
grid.dataSource.filter({
field: field,
operator: operator,
value: value
});
}
但是上面的函數從整個網格中搜索值。 但我需要從過濾后的網格中搜索值。 我該怎么做
您可以發送一組對象以保留當前過濾器並在第二個函數中添加一個新過濾器。
grid.dataSource.filter({
"filters": [
{
"field": field,
"operator": operator,
"value": value
},
{
"field": field2,
"operator": operator2,
"value": value2
}
],
"logic": "and"
})
一些文檔: https : //docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/filter
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.