1. #1
    Sencha User
    Join Date
    Apr 2009
    Posts
    30
    Vote Rating
    0
    rian.k is on a distinguished road

      0  

    Default BeanModelReader not working

    BeanModelReader not working


    Hi,

    please help, I won't see no tree with the following code:
    Code:
    Tree tree = new Tree();
        
    RpcProxy<List<User>> proxy = new RpcProxy<List<User>>() {
     @Override
     protected void load(Object o, AsyncCallback<List<User>> callback) {
       UsersService.App.getInstance().getUsers(callback);
     } 
    };
    
    BeanModelReader reader = new BeanModelReader();
    
    TreeLoader loader = new BaseTreeLoader(proxy, reader);
    
    TreeStore<BeanModel> store = new TreeStore<BeanModel>(loader);
    
    TreeBinder<BeanModel> binder = new TreeBinder<BeanModel>(tree, store);
    binder.setAutoLoad(true);
    
    loader.load();
    
    panel.add(tree);
    My app works with this though
    Code:
    tree = new Tree();
    
    TreeBuilder.buildTree(tree, model);
    tree.getStyle().setLeafIconStyle("icon-list");
    
    panel.add(tree);
    Am I missing something?

    thanks

  2. #2
    Sencha User
    Join Date
    Apr 2009
    Posts
    30
    Vote Rating
    0
    rian.k is on a distinguished road

      0  

    Default


    found a solution, it's a bug. BeanModelReader should return a List<ModelData> instead of a ListLoadResult<ModelData>:

    Code:
    public class BeanModelReaderAdapter implements DataReader<List<ModelData>> {
    
      private BeanModelReader reader;
    
      public BeanModelReaderAdapter(BeanModelReader reader) {
        this.reader = reader;
      }
      public List<ModelData> read(Object loadCfg, Object data) {
        if (loadCfg != null)
          return null;
        List<ModelData> result = reader.read(loadCfg, data).getData();
        return result;
      }
    }
    thanks to this thread: http://extjs.com/forum/showthread.php?t=50402

  3. #3
    Ext User
    Join Date
    Jun 2008
    Posts
    365
    Vote Rating
    0
    sdc is on a distinguished road

      0  

    Default


    Hi,

    I encountered the same issue with 1.x. Did you already post a bug ?
    @GXT team : is it already fixed in 1.x/2.x ?

Thread Participants: 1