I am using the Kendo Hierarchical Datasource for a Kendo UI Treeview.
On a click event, I want to leave only the checked roms in the datasource.
I tried
$('#treeview')
.getKendoTreeView()
.dataSource
.filter({
field: "checked",
operator: "eq",
value: true });
But to no avail.
Do I have the correct field?
Also, for bonus points, how do I remove the filter?
Best Answer
checked
is the correct field if you have defined it as so in the template :in my case, it is named
isChecked
(seeitem.isChecked
in my code).But, in order to filter correctly, be careful :
filter
only acts on the current level (see for example this question).And for your bonus question, to remove the filter, simply apply the following code :
(same as before on all levels on your hierarchy!).
Edit
Here is some fiddle in order to play with the filter : http://jsfiddle.net/scaillerie/RHh67/ .