punya
punya

Reputation: 23

kendo grid is not filtered properly

I have a kendo grid,and treeview with checkboxes in my application.I want to filter the grid based on treeview checkbox selection,i tried this one but its not working properly my treeview code is

    $("#treeview").on("change", function (e) {
   var ds = $("#grid").data("kendoGrid").dataSource;
    ds.filter([
    {"logic":"or",
     "filters":[
         {
            "field":"OrderId",
            "operator":"eq",
             }
     ]}    ]);
  });

my fiddle is http://jsfiddle.net/RHh67/66/

Upvotes: 0

Views: 321

Answers (1)

dvv
dvv

Reputation: 138

In treeview on change event you need to catch the checked nodes,and then filter the grid datasource based on your condition with field,operator and value of the treeview selected node.

 $("#treeview").on("change", function (e) {
    var selected = $('#treeview :checked').closest('li');
    var ds = grid.dataSource;
    var filter = {
        logic  : "or",
        filters: []
    };

This is the updated fiddle: http://jsfiddle.net/RHh67/87/

Cheers, Happy coding

Upvotes: 1

Related Questions