View Full Version : setExpanded deep Async TreeGrid / Access TreeNode

16 Aug 2009, 10:03 PM
Hi im using an aSync TreeGrid to load a Tree with about 250000 nodes. I would like to have the ability to expand a Node up to its leafs.
The problem is that when i use setExpanded(x,true,true); the RPC function to extract the next
child gets only called once.

I therefore added a MenuItem Expandall wich calls another RPC function to get not just one Child but all the childs for that node

insert.addSelectionListener(new SelectionListener<MenuEvent>() {
public void componentSelected(MenuEvent ce) {
final FileModel folder = pathtree.getSelectionModel().getSelectedItem();
if (folder != null) {
boolean m1Folder = folder instanceof FolderModel;
//pathtree.setExpanded(folder, true,true);
fileservice.getExpandedall(folder, new AsyncCallback<List<FileModel>>() {

public void onFailure(Throwable caught) {
// TODO Auto-generated method stub


public void onSuccess(List<FileModel> result) {
// TODO Auto-generated method stub
for(FileModel model :result)


pathtree.setExpanded(folder, true,true);


I debuged the code and the node to be deep expanded contains all the children (> level1).
but after the call of pathtree.setExpanded(folder,true,true) the node only contains the children for the first level.

I looked up the TreeGrid code and setExpanded deletes the node and the tries to recursively add the children by calling the loader. That does not work in my case.

Any idea how i can achieve this. I can not load the complete tree( 2 big) so i need some expanded deep just for some nodes. Is there a way to access the TreeNode object and set the field expanded to true