Hi guys
At startup, my application do somenthing like this:
...
TreeGrid treeGrid = new TreeGrid();
treeGrid.setDataSource(DataSource.getInstance());
treeGrid.fetchData();
selectNode(presenterName);
....
public void selectNode(String presenterName) {
Tree tree = menuTreeGrid.getData();
TreeNode treeNode = (TreeNode) tree.find("presenterName",
presenterName);
if(treeNode != null) {
menuTreeGrid.selectSingleRecord(treeNode);
}
}
That code never works at startup because treeNode is null. Looks like the treeGrid its not draw yet or something like that. If I create a simple test button that calls selectNode(...) its works. The tree.find(...) returns a valid treeNode.
I tried use this:
treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent event) {
//...
selectNode(...);
}
}
but dit not work too.
So, how the hell I know the time to call selectNode(...) ?
At startup, my application do somenthing like this:
...
TreeGrid treeGrid = new TreeGrid();
treeGrid.setDataSource(DataSource.getInstance());
treeGrid.fetchData();
selectNode(presenterName);
....
public void selectNode(String presenterName) {
Tree tree = menuTreeGrid.getData();
TreeNode treeNode = (TreeNode) tree.find("presenterName",
presenterName);
if(treeNode != null) {
menuTreeGrid.selectSingleRecord(treeNode);
}
}
That code never works at startup because treeNode is null. Looks like the treeGrid its not draw yet or something like that. If I create a simple test button that calls selectNode(...) its works. The tree.find(...) returns a valid treeNode.
I tried use this:
treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent event) {
//...
selectNode(...);
}
}
but dit not work too.
So, how the hell I know the time to call selectNode(...) ?
Comment