Hi,
why it is not possible to load nodes into a TreeGrid using a DataSource initialized via setTestData() and having client only = true? While searching for an answer, I have found in the forum statements saying that a TreeGrid can be manually initialized only by creating a Tree instance. Since TreeGrid extends ListGrid and there such technique is possible, not being able to that with TreeGrid is somehow misleading.
I have used the following snippet for testing:
Best,
Predrag
why it is not possible to load nodes into a TreeGrid using a DataSource initialized via setTestData() and having client only = true? While searching for an answer, I have found in the forum statements saying that a TreeGrid can be manually initialized only by creating a Tree instance. Since TreeGrid extends ListGrid and there such technique is possible, not being able to that with TreeGrid is somehow misleading.
I have used the following snippet for testing:
Code:
TreeGrid treeGrid = new TreeGrid(); DS ds = new DS("foo"); Record r1 = new Record(); r1.setAttribute("id", "1"); r1.setAttribute("label", "test"); r1.setAttribute("parent", ""); ds.setTestData(new Record[] {r1}); treeGrid.setShowRoot(true); treeGrid.setDataSource(ds); treeGrid.setFields(new TreeGridField("label")); treeGrid.setHeight(400); addMember(treeGrid); treeGrid.fetchData(); class DS extends DataSource { public DS(String _id) { setID(_id); DataSourceTextField idField = new DataSourceTextField("id"); idField.setPrimaryKey(true); DataSourceTextField labelField = new DataSourceTextField("label"); DataSourceTextField parentField = new DataSourceTextField("parent"); parentField.setForeignKey("id"); parentField.setRootValue(""); setFields(idField, labelField, parentField); setClientOnly(true); } }
Predrag
Comment