I load a treegrid from a RestDataSource shown below. If I request a getPath(node) I get a path like /1/4/7 rather than /lib/foo/bar. If I try to get the NameProperty, it display "$399". If I try to set the name property I get a null exception. Since a Datasource creates the tree, how do I set it up to display names in paths?
Code:
private ProjectDataSource getData(Map<String,String> args) {
String context = args.get("context");
assert(context != null);
ProjectDataSource datasource = new ProjectDataSource(context,"ThinkSpace","library.xq");
datasource.setRecordXPath("/response/data/record");
for (String name: args.keySet())
datasource.addParameter(name,args.get(name));
DataSourceIntegerField id = new DataSourceIntegerField("fid", "ID");
id.setValueXPath("@fid");
id.setPrimaryKey(true);
id.setRequired(true);
DataSourceIntegerField parent = new DataSourceIntegerField("parent", "Parent");
parent.setValueXPath("@parent");
parent.setRequired(true);
parent.setForeignKey("fid");
parent.setRootValue("1");
DataSourceBooleanField isFolder = new DataSourceBooleanField("isFolder", "IsFolder");
DataSourceTextField name = new DataSourceTextField("name", "Name");
name.setValueXPath("@name");
name.setRequired(true);
DataSourceDateField modified = new DataSourceDateField("modified", "Modified");
DataSourceIntegerField size = new DataSourceIntegerField("size", "Size");
DataSourceTextField icon = new DataSourceTextField("icon", "Icon");
datasource.setFields(new DataSourceField[]{id,parent,name,isFolder,modified,icon,size});
return datasource;
}
Comment