I have a 3 level CellBrowser. Everything is working fine using a 
ListDataProvider except that it's too long to grab the data from the server. 
So I want to use the AsyncDataProvider to fetch only the data that the user 
actually needs. Basically what I want to do is when the user selects the 
level1 value, the level2 provider executes a RPC call to get the level2 data 
based on the selected level1 parent. The problem is that the onRangeChanged 
method is called before the onSelectionChange, so when the RPC call is done 
the level1 value is still null. What is the proper way to use 
AsyncDataProvider to grab the level2 data depending on the level1 selected 
value?


public class SportTreeModel implements TreeViewModel, Handler {
  private AsyncDataProvider<Level1Node> level1Provider;
  private AsyncDataProvider<Level2Node> level2Provider;
  private final SingleSelectionModel<Level1Node> level1SelectionModel;
  // In the construtor I create these objets
  // In getNodeInfo I link a cell with the data provider and the selection 
model
  
    @Override
    public void onSelectionChange(SelectionChangeEvent event) {
        Object src = event.getSource();
        if (src == level1SelectionModel) {
            Level1Node level1 = level1SelectionModel.getSelectedObject();
            ((MyAsyncLevel2Provider) 
level2Provider).setLevel1(level1.getValue());
        }
    }
}

Thanks



-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to