Hi,
i use Smartgwt 3.0. Im working on a Tree that shows directory structure. As i know, which node is Folder and which is not i wanted to reduce the requests by setting setIsFolderProperty. This unfortunately doesnt work for me. I've also changed the property defaultIsFolder but also no change. This is how im using it:
Im sendig data from server in format: {"response":{"size":1,"data":[{"name":"tmp","path":"/tmp","dir":true}]}}
In the TreeGrid i can see the dir property but every node is displayed as a Folder.
Thanks in advance.
i use Smartgwt 3.0. Im working on a Tree that shows directory structure. As i know, which node is Folder and which is not i wanted to reduce the requests by setting setIsFolderProperty. This unfortunately doesnt work for me. I've also changed the property defaultIsFolder but also no change. This is how im using it:
Code:
private static class FilePickerWindow extends Window {
private static final RestDataSource directoryDataSource;
static {
directoryDataSource = new RestDataSource();
directoryDataSource.setID("directoryBrowserDataSource");
directoryDataSource.setDropExtraFields(false);
directoryDataSource.setDropUnknownCriteria(false);
directoryDataSource.setDataProtocol(DSProtocol.GETPARAMS);
directoryDataSource.setDataFormat(DSDataFormat.JSON);
DataSourceField name = new DataSourceTextField("name");
DataSourceField parent = new DataSourceTextField("parent");
DataSourceField path = new DataSourceTextField("path");
DataSourceField directory = new DataSourceBooleanField("dir");
parent.setForeignKey("path");
path.setPrimaryKey(true);
directoryDataSource.setFields(name, parent, path, directory);
directoryDataSource.setDataURL(GWT.getHostPageBaseURL() + "directoryBrowser");
}
private String openingNodeId;
private FilePickerWindow() {
Tree tree = new Tree();
tree.setModelType(TreeModelType.CHILDREN);
tree.setIdField("name");
tree.setNameProperty("name");
tree.setIsFolderProperty("dir");
tree.setDefaultIsFolder(false);
final TreeGrid treeGrid = new TreeGrid();
treeGrid.setData(tree);
treeGrid.setDataSource(directoryDataSource);
treeGrid.setLoadDataOnDemand(true);
treeGrid.setKeepParentsOnFilter(true);
treeGrid.setFields(new TreeGridField("name"), new TreeGridField("path"), new TreeGridField("dir"));
treeGrid.setAutoFetchData(true);
addItem(treeGrid);
setWidth(300);
setHeight(400);
setCanDragResize(true);
}
}
In the TreeGrid i can see the dir property but every node is displayed as a Folder.
Thanks in advance.
Comment