PDA

View Full Version : Adding a model to TreeStore results in duplicate nodes



erincarikan
25 Mar 2009, 12:06 PM
I am trying to change the structure of my reordering tree based on a selection event from another table. I tried a lot of things and nothing seemed to work. My final approach is as follows: I keep a reference to reordering tree's treestore and its root item's model. They are respectively named as store and dragRoot.


Here's the code that I use to add a node to the tree. When it's executed, it creates two nodes under the root of the tree. I can't seem to understand what is wrong with this.




MediasetModel md = new MediasetModel("am",1);



store.add(dragRoot, md, false);
store.update(dragRoot);


Can somebody please help me, I struggled about this problem at least for 2 days, and it looks like it's one of the most basic functionality of a tree, It isn't supposed to be this hard. Nobody seems to be able to help.

erincarikan
25 Mar 2009, 1:20 PM
I realized this only happens when the store update takes place because of a async call back, if I take it outside of async call back function, it updates the store correctly. I keep counters to check if async function is called once. And it looks like it's being called once. I need to make the update in async call back, I get the data from database, please help!