javascript - Querying Attribute Properties for dojo.data.ItemFileWriteStore (Not so easy) -


I have a dojo.data.ItemFileWriteStore object, which has a 'children' attribute, which in turn includes an array Items of children I am storing a tree, and I need to bring leaf nodes from this tree. I have written a fetch method but it will not work to give a query to children: [] "How can I get data store items whose children are 0 length (leaf nodes)? An empty array without adding features like 'leaf': My objects have to work clearly, but I do not have any extra features.

  dojo.require (dojo.data.ItemFileWriteStore); // No tree node with a tree, this is the way I ask // returned! Var Route Type = {Children: []}; Var treestore = new dojo.data.ItemFileWriteStore ({data: {item: [root unit}}}); // When Dojo reaches one of its inner filtering methods // is a point where it calls dojo.some () // to see which element returning to the array / matches the given item attribute , This is where it fails TreeStore.fetch ({query: {children: []}, query options: {deep: true}, interrupted: function (leaves) {// here all items with any children Are not ...}});   

I also tried to try a function for a function to get a profit:

  treeStore.fetch ({query: {children: Function (store, item) {Return store.getValue (item, 'kids'). Length == 0;}}, queryation: {depth}, succeeding: function (leaf items) {// here with any children Not all items are ...}});    

  basestore.phet ({query: {id: '*'} , But complete: function (a, b, c) {dojo.forEach (a, function (item, index) {console.log (item.children);})}})   

If the item Children are undefined, then those "items" are what you want. If you do not want to use a different fetch for this operation alone, use a personal property called _arrayOfAllItems on the store to get the flat data store, on which you can make the same situation mentioned above.

Comments