In my application, I'm using kendo grid and I'm using kendoDropDownList
to filter data source as follows,
<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>
How I calling the 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([]);
}
}
});
The above code works fine and now I need to search value from above filtered
result. How can I do it?
I wrote the search function as follows
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
});
}
But the above function searching value from the whole grid. But I need to search value from the filtered grid. How can I do it
You can send an array of objects to keep the current filter and add a new one in your second function.
grid.dataSource.filter({
"filters": [
{
"field": field,
"operator": operator,
"value": value
},
{
"field": field2,
"operator": operator2,
"value": value2
}
],
"logic": "and"
})
Some documentation: https://docs.telerik.com/kendo-ui/api/javascript/data/datasource/configuration/filter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.