PDA

View Full Version : BeanModelReader not working



rian.k
18 May 2009, 4:53 AM
Hi,

please help, I won't see no tree with the following 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

tree = new Tree();

TreeBuilder.buildTree(tree, model);
tree.getStyle().setLeafIconStyle("icon-list");

panel.add(tree);

Am I missing something?

thanks

rian.k
19 May 2009, 3:05 AM
found a solution, it's a bug. BeanModelReader should return a List<ModelData> instead of a ListLoadResult<ModelData>:



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 (http://extjs.com/forum/showthread.php?t=50402&page=2)

sdc
25 May 2009, 4:03 AM
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 ?