PDA

View Full Version : How to dynamically change the (tree)node ID that was a function of getNodeById?



MorliDots
3 Dec 2013, 4:48 AM
good day.
create a node, changing later ID. How it then find function getNodeId ?


Ext.define('MyTree', {
extend: 'Ext.tree.Panel',
store: Ext.create('Ext.data.TreeStore',




var myNode = this.store.getRootNode();
myNode.appendChild({id: 1, text: ,leaf: true, checked: true});


later
var node = this.store.getNodeById(1);
node.data.id = 2;


and ...
var node = this.store.getNodeById(2); => node = undefined
var node = this.store.getNodeById(1); => node = []


if ...
var node = this.store.getNodeById(1);
node.data.id = 2;
this.store.tree.registerNode(node); //< - add in hash


var node = this.store.getNodeById(2); => node = []


how to edi without hack?

Gary Schlosberg
6 Dec 2013, 10:40 AM
I'm having a bit of trouble understanding your question. Can you please clarify, or better yet provide some runnable test code to illustrate?
https://fiddle.sencha.com/#home