i found out how refresh tree , works fine. want focus on specific node , says _itemnodesmap undefined.
here have:
require([ "dojo/_base/window", "dojo/data/itemfilewritestore", "dijit/tree/foreststoremodel", "dijit/tree", "dojo/domready!" ], function(win, ifrs, foreststoremodel, tree){ dojo.extend(tree, { reload: function (data, path) { this.dndcontroller.selectnone(); this.model.store.clearonclose = true; this.model.store.close(); this._itemnodesmap = {}; this.rootnode.state = "unchecked"; this.model.root.children = null; this.rootnode.destroyrecursive(); var _data = {identifier: "id", label: "label", items: data}; var _store = new ifrs({data:_data}); var _treemodel = new foreststoremodel({ store: _store, rootid:"root", rootlabel:"things", childrenattr:["children"] }); this.model.constructor(_treemodel); this.postmixinproperties(); this._load(); path.unshift("root"); this.set('path',path); }});
for focussing tried add following , call after setting path:
scroll : function(path){ var itemnode = this._itemnodesmap[path[path.length-1]]; this.focusnode(itemnode[0]); }
but _itemnodesmap undefined. why? tree displayed, path set , except works. great help. thanks!
i believe setting path deferred process, assuming path
variable in scroll
function has taken consideration, use following focus on tree item (node) in then
function:
var item = mytree.path[path.length-1]; var nodes = mytree.getnodesbyitem(item); if (nodes && nodes.length > 0 && nodes[0]) { nodes[0].domnode.scrollintoview(true); }
Comments
Post a Comment