Have you tried setting the filter-field of the datasource?
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-filter
Snippet from that page:
<script>
var dataSource = new kendo.data.DataSource({
data: [
{ name: "Jane Doe" },
{ name: "John Doe" }
],
filter: { field: "name", operator: "startswith", value: "Jane" }
});
dataSource.fetch(function(){
var view = dataSource.view();
console.log(view.length); // displays "1"
console.log(view[0].name); // displays "Jane Doe"
});
</script>
If you want to set a filter value of your own you'll have to set it on the grid's dataSource.
You can do it when you initialize the data source using the filter parameter:
$("#grid").kendoGrid({
dataSource: {
filter: { field: "YourFiledName", operator: "startWith", value: "A" }
//Other parameters...
}
});
... or you can do it after the grid initialization if you need to by using the dataSource filter method:
$("#grid").data("kendoGrid").dataSource.filter({ field: "YourFiledName", operator: "startWith", value: "A" });
You should just provide initial filter to the dataSource. Check the API reference here .
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.