I'm trying to wrap my head around how the TreeGrid works with an GWTRPCDataSource.
First I'm using eclipse 3.5, SmartGWT 2.2 and Safari.
I have gotten to the point where my tree loads and displays labels. I can open and close folders and see the children of the parents. So I'm pretty happy in general.
However, I'm a little confused. The tree is configured like this:
TreeGrid treeGrid = new TreeGrid();
treeGrid.setAutoFetchData(true);
treeGrid.setDataSource(StackDataSource.getInstance());
It contains one field:
TreeGridField field = new TreeGridField("Lessons");
field.setCanSort(true);
field.setCellFormatter(new CellFormatter()
{
public String format(Object value, ListGridRecord record,
int rowNum, int colNum) {
return record.getAttribute("name");
}
});
treeGrid.setFields(field);
The record that comes across the wire has no indicator that any node in the tree has children. So I'm a bit confused how the TreeGrid knows to display the + that allows you to expand the folder.
This is also a problem because when I get to the leaves of the tree, they too are displayed with a folder that makes it seem that they have children also.
There is a model server side of the tree, that contains all the data that the tree holds. To move the data from server side to client side, I created a ClientNode, which contains fields for all the properties that need to be viewed client side but does not for instance, include an array of children.
So my questions are:
1) How does the grid know to put the folder and + sign when on the client side there is no indication of the presence of children?
2) How can I change on any particular line, the icon being displayed? Currently is't the folder Icon. What would I do if I wanted to use a different type, at different levels?
3) How do I prevent the Tree, from placing a folder and the expand box, on any row? (Related to 1)
Thanks for your help.
Tony
First I'm using eclipse 3.5, SmartGWT 2.2 and Safari.
I have gotten to the point where my tree loads and displays labels. I can open and close folders and see the children of the parents. So I'm pretty happy in general.
However, I'm a little confused. The tree is configured like this:
TreeGrid treeGrid = new TreeGrid();
treeGrid.setAutoFetchData(true);
treeGrid.setDataSource(StackDataSource.getInstance());
It contains one field:
TreeGridField field = new TreeGridField("Lessons");
field.setCanSort(true);
field.setCellFormatter(new CellFormatter()
{
public String format(Object value, ListGridRecord record,
int rowNum, int colNum) {
return record.getAttribute("name");
}
});
treeGrid.setFields(field);
The record that comes across the wire has no indicator that any node in the tree has children. So I'm a bit confused how the TreeGrid knows to display the + that allows you to expand the folder.
This is also a problem because when I get to the leaves of the tree, they too are displayed with a folder that makes it seem that they have children also.
There is a model server side of the tree, that contains all the data that the tree holds. To move the data from server side to client side, I created a ClientNode, which contains fields for all the properties that need to be viewed client side but does not for instance, include an array of children.
So my questions are:
1) How does the grid know to put the folder and + sign when on the client side there is no indication of the presence of children?
2) How can I change on any particular line, the icon being displayed? Currently is't the folder Icon. What would I do if I wanted to use a different type, at different levels?
3) How do I prevent the Tree, from placing a folder and the expand box, on any row? (Related to 1)
Thanks for your help.
Tony
Comment