Hi,
I have a TreeGrid defined as follows:
What is the best way to expand all selected nodes?
At the moment I call
the problem is that this doen't expand all nodes recursively. It fetches data for one level only. Then I do the recursion manually. First I check if all nodes under selected nodes are open and loaded. If it at least one node is not loaded then I can expect DataArrivedEvent where I call openAll for the new loaded nodes. When all nodes are open and loaded then I start the drag and drop operation.
There is, however, too many server-side calls. Is there a better way to do so?
My goal is to drag and drop leaves on selected nodes in a tree.
best regards,
Zdary
I have a TreeGrid defined as follows:
Code:
Tree grid1Tree = new Tree(); grid1Tree.setModelType(TreeModelType.PARENT); grid1Tree.setRootValue("ROOT"); grid1Tree.setTitleProperty("title"); grid1Tree.setIdField("nodeID"); grid1Tree.setParentIdField("parentNode"); grid1Tree.setNameProperty("name"); ... TreeGrid treeGrid = new TreeGrid(); treeGrid.setDataSource(DataSource.get("DS")); treeGrid.setData(grid1Tree);
At the moment I call
Code:
TreeGrid.getData().openAll(node);
Code:
boolean isOpen = sourceTreeGrid.getData().isOpen(node); boolean isLoaded = sourceTreeGrid.getData().isLoaded(node); treeGrid.addDataArrivedHandler(new DataArrivedHandler() { @Override public void onDataArrived(DataArrivedEvent event) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { TreeGrid.getData().openAll(node); } }); } });
My goal is to drag and drop leaves on selected nodes in a tree.
best regards,
Zdary
Comment