-
28 May 2010 12:00 PM #1
How to avoid async call when expand tree node if model data ready in tree store
How to avoid async call when expand tree node if model data ready in tree store
I have Async tree and I preload the model data into the tree store and then I use selection model to select a node in the tree. It is supposed to expand the tree path all the way to the node selected. But the tree still make the async call one by one all the way down to the selected node.
Why the model data in the tree store already and it still make async call when expand the tree node? Is there any way to disable the async service call if the data already in the tree store?
Thanks in advance
-
28 May 2010 1:20 PM #2
i just hit the same behavior and i am looking for a solution:
* full tree is initially loaded via rpc proxy
* despite of this - on click, it makes a new rpc call
seems like the tree is designed either to have all the info locally or load at each level. This in-between state should be easy to do perhaps by extending TreeGrid. Does any one have it coded?
If i dont hear anything by end of the weekend , i will have a crack at it..
thanks
-
1 Jun 2010 7:57 AM #3
my current solution is to have a temp store with the rpc loader. i dont display it but just add a store listener that simply copies the data to the actual store. think that will work because should behave exactly like the static data loading. so far works as intended.
-
1 Jun 2010 8:20 PM #4
Would it be possible to tell me what listener you added and how to copy the data?
Thanks.
-
2 Jun 2010 5:21 AM #5
delegate is the real Grid that gets the data via RPC
The deferred command copies the data from the delegate and aggregates it. Because only my leaf nodes contain full data, the grouping nodes only contain the grouping information.Code:if (delegate!=null){ delegate.getTreeStore().addStoreListener(new StoreListener<BaseModel>(){ @Override public void storeDataChanged(StoreEvent<BaseModel> se) { act(); } private void act(){ final List<BaseModel> models = delegate.getTreeStore().getModels(); DeferredCommand.addCommand(new Command() { public void execute() { long time1 = System.currentTimeMillis(); grid.getTreeStore().removeAll(); for(ColumnConfig cc : grid.getColumnModel().getColumns()){ String header = cc.getId(); DependentRule.RecursiveTotalRule aggregator = new DependentRule.RecursiveTotalRule(header ); for(BaseModel bm : models){ aggregator.get(bm); } } grid.getTreeStore().add(models, true); GWT.log("data copied and aggregated in "+(System.currentTimeMillis()-time1), null); } }); } } @Override public void storeAdd(StoreEvent<BaseModel> se) { act(); } @Override public void storeUpdate(StoreEvent<BaseModel> se) { act(); } });
Similar Threads
-
To stop tree loader to call on tree expand
By Sejal in forum Ext 3.x: Help & DiscussionReplies: 0Last Post: 28 Apr 2010, 12:57 AM -
[CLOSED] The parent of selected tree node is NULL in Async Tree
By fangning in forum Ext GWT: Bugs (2.x)Replies: 3Last Post: 10 Nov 2009, 12:15 AM -
[CLOSED][3.0rc1] Async Tree node doesn't expand
By Sesshomurai in forum Ext 3.x: BugsReplies: 3Last Post: 29 Apr 2009, 5:47 AM -
RpcProxy as way to avoid GWT async rpc model
By cri1258 in forum Ext GWT: Help & Discussion (1.x)Replies: 0Last Post: 7 Mar 2009, 9:35 AM -
call function on dblclick of tree node and disable expand/collapse
By vayumahesh in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 20 Nov 2008, 10:30 AM


Reply With Quote