0

I have created a kendo HierarchicalDataSource

var fontidatasource = new kendo.data.HierarchicalDataSource({
data: vm.get("Source")
});

I want search in it the item that are checked.

I have tried to use a gatherStates function (kendo documentation), but don't function...

Ciccio
  • 468
  • 4
  • 17
  • But... how do you _check_ items in a `HierarchicalDataSource`? Do you mean a `kendoTreeView` that (of course) uses as data source a `HierarchicalDataSource`? – OnaBai Jan 24 '13 at 12:20
  • In my HierarchicalDataSource there is a voice checked: true or false {checked:true} No i want to see the checked item without the kendotreeview, in kendo treeview i know how do it. – Ciccio Jan 24 '13 at 12:28
  • Is that checked part of HierarchicalDataSource? I cannot see any documentation on that. Or do you mean that is a field that you defined on each node of the tree? – OnaBai Jan 24 '13 at 12:30
  • Yes is a field defined on each node. { id:.... checke:true, items: [{ id:... checked:false},{id... checked:true}]} – Ciccio Jan 24 '13 at 12:34

1 Answers1

0

I'm afraid that there is not such filtering option for HierarchicalDataSources.

You might try this answer even that it says TreeView it applies here since the data model is the same.

Community
  • 1
  • 1
OnaBai
  • 40,767
  • 6
  • 96
  • 125
  • There is a way to make a loop to iterate through the HierarchicalDataSources? – Ciccio Jan 24 '13 at 13:43
  • If you don't mind too much about memory: write your own recursive function? – OnaBai Jan 24 '13 at 15:42
  • I try to write it but it tell error.. if you want to help me. – Ciccio Jan 25 '13 at 10:41
  • I would need to know more exactly what should be the output of the function, the id, the elements without items, a reference to found elements... – OnaBai Jan 25 '13 at 10:45
  • Json example: [{ id: "id", checked: true, items: [{ id: "id", checked: true, items:[]}, {id: "id", checked: true, items:[]}] }] I want to do an action when an element have cheched:true The tree can have more level... – Ciccio Jan 25 '13 at 10:57
  • I want to create a function that search in the hierarchical json object all the element that have checked:true and put the element in an array. – Ciccio Jan 25 '13 at 11:15
  • You still did not define how does the output look like and what about if one node says `checked: false` if it should stop the search. If the output is a tree, I expect so. – OnaBai Jan 25 '13 at 11:23
  • No in the function if the checked:true i want to doing a push in an array. if it false nothing. and there is no output because i want to do the cicle for fill an array. – Ciccio Jan 25 '13 at 11:28
  • FUNCTION CICLE if(el.checked) { push({el}); } else {} END CICLE END FUNCTION – Ciccio Jan 25 '13 at 11:29