PDA

View Full Version : [CLOSED] Dynamically add or rename leaves in tree grid



craig2005
Jul 06, 2012, 9:10 PM
How do you dynamically add or rename leaves in a tree grid? Lets use your example.

http://examples2.ext.net/#/TreePanel/Advanced/TreeGrid/

How would I add or rename a leaf under "Remodeling"?

I've tried to update the store, but then I couldn't get the tree to reload with the updated store data.

Daniil
Jul 08, 2012, 9:20 PM
Hi,

Yes, you should deal with the Store.

You should get a node. For example, using the getNodeById function.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.TreeStore-method-getNodeById (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.data.TreeStore-method-getNodeById)

When you can change the attributes using the set method.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.Model-method-set (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.data.Model-method-set)

To remove the node, call its remove method.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-method-remove



I've tried to update the store, but then I couldn't get the tree to reload with the updated store data.

I am afraid I have not understood what you would expect. Do you reload from server? Does server know about client side changes?