filter
Returns a copy of the list filtered according to the expression
Parameters
expression Object
The filter configuration. Accepts the same values as the filter option (check there for more examples).
Returns
kendo.data.Query
Returns a new instance of kendo.data.Query containing the filtered collection
Example
<script>
var query = new kendo.data.Query([
{ name: "Jane Doe", age: 30, department: "Sales" },
{ name: "John Doe", age: 33, department: "IT" },
{ name: "Bob Smith", age: 25, department: "Sales" },
{ name: "Alice Johnson", age: 28, department: "Marketing" }
]);
var filteredQuery = query.filter({
logic: "and",
filters: [
{ field: "age", operator: "gte", value: 28 },
{ field: "department", operator: "eq", value: "Sales" }
]
});
var result = filteredQuery.toArray();
// the result can be seen in the browser console.
console.log(result); // Will contain only Jane Doe (age >= 28 and department = Sales)
</script>
In this article