PDA

View Full Version : treegrid + auto load equals false



fother
24 Aug 2009, 12:01 PM
I create one tree grid that have, rpc proxy, loader and store.. but I need load the data only when click on the button.. its possible do this?

Arno.Nyhm
25 Aug 2009, 4:31 AM
i think you call the loader in the button event and not before!?

fother
25 Aug 2009, 4:47 AM
I dont understand very well what you told..

but the problem is that always when use a tree grid with proxy, store and loader.. when the tree grid its render.. call the rpc.. and I dont identify when call the method load..

Arno.Nyhm
25 Aug 2009, 8:16 AM
i think there are not magic loding with the loader. because you not post your code i can only guess what you do :-(

but if you look at this source code in this example then you need to move this loader.load to your button click event. then its not loaded automaticly, it is loaded after the button click.

http://extjs.com/examples/explorer.html#asynctreegrid



final FileServiceAsync service = (FileServiceAsync) Registry.get(Examples.FILE_SERVICE);
// data proxy
RpcProxy<List<FileModel>> proxy = new RpcProxy<List<FileModel>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<List<FileModel>> callback) {
service.getFolderChildren((FileModel) loadConfig, callback);
}
};
// tree loader
final TreeLoader<FileModel> loader = new BaseTreeLoader<FileModel>(proxy) {
@Override
public boolean hasChildren(FileModel parent) {
return parent instanceof FolderModel;
}
};
// trees store
final TreeStore<FileModel> store = new TreeStore<FileModel>(loader);
// ...
loader.load(null);