View Full Version : Change a node's text

27 Aug 2012, 4:37 AM

I have a node with ID = 1. I would like to add some text into its existing text when the tree is render. And I want also update this text when there is an event. How can I get a specific node by ID or by name? How can I reset it text?
I tried to search in document but I didnt see neither the method getNodeById of Treepanel nor setText of treenode

Thank you

27 Aug 2012, 5:36 AM
Try this:

var node = treeStore.getNodeById(nodeId);
node.set('text', 'New Text');

27 Aug 2012, 5:41 AM

You can get tree node by the getNodeById() method of treePanel store class, like

var node = yourTreePanel.store.getNodeById('nodeId');

Read API docs -http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.TreeStore-method-getNodeById

27 Aug 2012, 11:13 PM
Yeah, you re right. I found this after posting this thread because "Google say" :), getNodeById is from Tree.

Thank you