PDA

View Full Version : updating a tree



pedwards
26 Mar 2014, 5:10 AM
I am using a tree panel and I would like to update all the data.

My first thought was to just change all the data in the store. I am using a TreeStore with inline data but I couldn't see how to do it? I.e.




var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "detention", leaf: true },
{ text: "homework", expanded: true, children: [
{ text: "book report", leaf: true },
{ text: "algebra", leaf: true}
] },
{ text: "buy lottery tickets", leaf: true }
]
}
});

// can I set a new root somehow? This doesn't work but something like:

store.root = {
expanded: true,
children: [
{ text: "new data", leaf: true }
]
};




The second thing I tried was to just create a new store but then I couldn't see how to set that on the Ext.tree.Panel - is this possible?

Thanks in advance,
Paul

pedwards
26 Mar 2014, 5:31 AM
I've worked it out - setRootNode

Gary Schlosberg
27 Mar 2014, 9:11 AM
Thanks for following up and sharing your findings with the community.