Hi All,
I have a treegrid hooked up to a RestDatasource and a listgrid hooked up to another grid source. The treegrid is used to select what data should be displayed in the listgrid.
For now I am trying to figure out how to automatically select the first leaf (isFolder = false) on the tree when my program starts. If I can do this I can then populate listgrid with the data associated with it. In plain old GWT I was able to do this by keeping track of the first widget that was a leaf while I populated the tree and then after the tree was loaded I selected that widget in the tree and displayed it. This opened the tree up and selected the leaf.
How can I do this in SmartGWT? I do have access to the primary key associated with that first leaf if that helps.
Thanks for all of you help so far,
Arend
Just use Tree.find() or Tree.findById() once the data is loaded.
Hi,
Thanks for the reply. I do not use a Tree to populate my TreeGrid. I have it hooked to a datasource. This is one is based on a RestDataSource. When I access the tree using getTree() I get a value of null. I think this makes sense since the tree has not yet had a chance to load. I looked for a handler named something like “LoadComplete” that I could hook that indicated that the TreeGrid has initially loaded but could not find it. Does anybody have any suggestions.
Thanks again,
Arend
P.S. Following is how I create my TreeGrid:
public class ObjectTree extends TreeGrid {
public ObjectTree() {
super();
setShowResizeBar(true);
setFields(new TreeGridField("objectLabel","<i>Select Report Type</i>"));
setLoadDataOnDemand(false);
setAutoFetchData(true);
setSelectionType(SelectionStyle.SINGLE);
setDataSource(new ObjectTreeDataSource());
Tree tree = getTree();
}
}
There’s now a dataArrived event that would tell you when data is loaded (ListGrid or TreeGrid).