-
6 Oct 2010 8:28 AM #1
TreeStore.update() not updating nodes in TreePanel
TreeStore.update() not updating nodes in TreePanel
After updating a tree item on the tree store using TreeStore.update(), calling TreePanelSelectionModel.getSelectedItem() results in a stale item being returned.
I'm making a call to update an item on a tree store as follows:
The new tree item appears correctly in the tree based on the icon, as set in a custom iconSelector. That is, the items being passed to the icon selector include the updated item. Checking the actual TreeStore pointed to by both the TreePanel and the selection model shows that the updated item is indeed present in the tree store. The stale item does not exist in the store after the update.Code:BeanModel itemModel = beanModelFactory.createModel(item); tree.getStore().update(itemModel);
I'm getting the currently selected item as follows:
The model item is the pre-updated item (again, an item that does not exist in TreeStore, post update). However, Looking at the node list in the TreePanel itself shows the stale item is still in the node list. My understanding is that the update call on the tree store fires the Update event. Shouldn't this event result in updating the nodes in the tree?Code:TreePanelSelectionModel<BeanModel> selModel = tree.getSelectionModel(); BeanModel model = selModel.getSelectedItem();
How can I force the tree to see the update to the treestore? I need to have the selected item reflect the current item in the TreeStore, not a stale item held in the TreePanel.
Thanks!
-
6 Oct 2010 9:49 AM #2
There are some known limitations with update.
What are you doing exaclty? Why do you create a new BeanModel instance?
-
6 Oct 2010 10:55 AM #3
The change to the item is a status flag. This flag results in a new icon for the item in the tree and a different behavior of the context menu when that item is selected. I didn't want to reload the entire tree for a change to only a single item.
-
6 Oct 2010 11:01 AM #4
I dont understand why your selectionmodel still returns the old model with the old flag.
Can you try to reproduce your code in a small standalone testcase that implements EntyrPoint?
-
6 Oct 2010 11:05 AM #5
Ok, I'll try, but it'll be some time before I can get to it. I'm just reloading the entire tree for the time being.
Similar Threads
-
Possible to selectively render Nodes in a TreePanel with TreeStore<BaseTreeModel>
By richardcatlin in forum Ext GWT: DiscussionReplies: 2Last Post: 19 Sep 2010, 7:22 AM -
TreeStore not updating? (source included)
By british_trader in forum Ext GWT: DiscussionReplies: 6Last Post: 25 May 2010, 4:35 AM -
Adding a model to TreeStore results in duplicate nodes
By erincarikan in forum Ext GWT: Help & Discussion (1.x)Replies: 1Last Post: 25 Mar 2009, 1:20 PM


Reply With Quote