Hi
smartgwt-p3.0
i try to built a treegrid. This works, but no labels appear in the treegrid:
Client:
DS:
Servlet:
Developer Console has no errors..
What is to do that the label from 'name' or 'title' appears?
Thx
smartgwt-p3.0
i try to built a treegrid. This works, but no labels appear in the treegrid:
Client:
Code:
public void onModuleLoad() {
DataSource ds = AppsDS.getInstance();
TreeGrid tGrid = new TreeGrid();
tGrid.setLoadDataOnDemand(false);
tGrid.setDataSource(ds);
tGrid.setAutoFetchData(true);
tGrid.setWidth(500);
tGrid.setHeight(500);
tGrid.setShowRoot(false);
TreeGridField field = new TreeGridField("Name", "asdf", 450);
tGrid.setFields(field);
tGrid.draw();
}
Code:
public AppsDS(String id) {
setID(id);
setTitleField("title");
setRecordXPath("/AppList");
setDataFormat(DSDataFormat.JSON);
setDataURL("appData");
DataSourceIntegerField dsfID = new DataSourceIntegerField("appID", "ApplicationID");
dsfID.setPrimaryKey(true);
dsfID.setRequired(true);
DataSourceIntegerField dsfParentId = new DataSourceIntegerField("parentId", "ParentID");
dsfParentId.setForeignKey(id + ".appID");
dsfParentId.setRequired(true);
dsfParentId.setRootValue("1");
DataSourceTextField dsfName = new DataSourceTextField("name", "Name", 40);
DataSourceTextField dsfTitle = new DataSourceTextField("title", "Title", 40);
setFields(dsfID, dsfParentId, dsfName, dsfTitle);
setClientOnly(true);
}
Code:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
try {
PrintWriter out = resp.getWriter();
out.println("{AppList: [{appID : 10, parentId : 1, ame : \"Test\", title : \"Test\"}," +
"{appID : 20, parentId : 10, name : \"Test2\", title : \"Test2\"}," +
"{appID : 30, parentId : 10, name : \"Test3\", title : \"Test3\"}," +
"{appID : 40, parentId : 1, name : \"Test4\", title : \"Test4\"}," +
"{appID : 50, parentId : 40, name : \"Test5\", title : \"Test5\"}]}");
} catch (IOException e) {
e.printStackTrace();
}
}
What is to do that the label from 'name' or 'title' appears?
Thx