PDA

View Full Version : Adding node to Ext.data.TreeStore manually



Chemist
26 Aug 2013, 3:32 AM
I need some help. I have ordinary Ext.tree.Panel with Ext.data.TreeStore attached to it the only thing is that I need to add nodes to that store manually.

For now I do like this :



var store = Ext.getStore('Machines'),
root = store.getRootNode();

root.appendChild(nodeConfig);


this way node appears in the store, but it doesn't show in the tree, if I add node to the tree - node does not appear in the store. what am I doing wrong? can someone help? Maybe I need to call some function to synchronize? As I see now from the sources it should do it automatically, but getting events... But it doesn't happen

Phil Guerrant
26 Aug 2013, 5:11 AM
adding a node to the store should make it appear in the tree. Perhaps you need to set "expanded: true" on the parent node, or call its expand() method after adding the childNode?

The Tree Guide (http://docs.sencha.com/extjs/#!/guide/tree) has some helpful information in this regard

AssetWorks
26 Aug 2013, 5:37 AM
try this, this works for me


var node = root.createNode({
leaf: true,
text: scode
});
root.appendChild(node)