Reputation: 2342
I've made a JSBin that should explain what I'm looking to do:
http://jsbin.com/inikib/9/edit
I'm creating a Kendo UI Grid using Declarative Initialization...
<div data-role="grid"
data-columns="[ {field: 'name', title: 'Name'}, {field: 'price', title: 'Price'} ]"
data-bind="source: products">
</div>
...and I want to create a text field that will filter the name
field.
This is simple with a regular Kendo Grid, but is it possible to do with declarative initialization like above?
Edit:
I think I'm a little closer in this JSbin using $(el).data("kendoGrid").filter = {...};
(but not quite there yet)
Upvotes: 0
Views: 1413
Reputation: 2342
Answering my own question...
What I needed was:
$('.grid-filter').keyup(function() {
var filterText = $(this).val();
$('.data-grid').data("kendoGrid").dataSource.filter = function () {
return { field: "name", operator: "contains", value: filterText };
};
$('.data-grid').data("kendoGrid").dataSource.fetch();
});
I was missing $('.data-grid').data("kendoGrid").dataSource.filter and then $('.data-grid').data("kendoGrid").dataSource.fetch();
Upvotes: 0