Hello,
First of all, thank you for SmartGWT! It's been a slick and flexible way for me to write pretty advanced and good-looking GUIs!
I'm posting now with a problem I've encountered in Dev Mode when trying to draw a TreeGrid that is bound to a DataSource. I have my own client-only DataSource to which I addData() by creating TreeNode objects and defining their property values. (For my project, I want the root of the Tree to be some value that is less than 1 or is not an Integer; I would prefer a null value for convenience.)
As it is I get the "Loading Data..." message in the TreeGrid and an unspecific error message on the stderr console of my IDE: "Uncaught JavaScript exception [Exception thrown and not caught] in http://localhost:8080/Ticketer/gwt/Workbench/hosted.html?Workbench, line 281". The sample code posted below renders fine if I compile and run without Dev Mode. It also works in Dev Mode if I refactor the TreeGrid/TreeGridField/TreeNode objects to ListGrid/ListGridField/ListGridRecord.
Am I missing something? Have I done something stupid? Thanks for taking a look!
First of all, thank you for SmartGWT! It's been a slick and flexible way for me to write pretty advanced and good-looking GUIs!
I'm posting now with a problem I've encountered in Dev Mode when trying to draw a TreeGrid that is bound to a DataSource. I have my own client-only DataSource to which I addData() by creating TreeNode objects and defining their property values. (For my project, I want the root of the Tree to be some value that is less than 1 or is not an Integer; I would prefer a null value for convenience.)
As it is I get the "Loading Data..." message in the TreeGrid and an unspecific error message on the stderr console of my IDE: "Uncaught JavaScript exception [Exception thrown and not caught] in http://localhost:8080/Ticketer/gwt/Workbench/hosted.html?Workbench, line 281". The sample code posted below renders fine if I compile and run without Dev Mode. It also works in Dev Mode if I refactor the TreeGrid/TreeGridField/TreeNode objects to ListGrid/ListGridField/ListGridRecord.
Am I missing something? Have I done something stupid? Thanks for taking a look!
Code:
public class TreeGridDatasourceTest extends VLayout {
public TreeGridDatasourceTest() {
TreeGrid grid = new TreeGrid();
grid.setSize("125px", "100px");
grid.setLeaveScrollbarGap(false);
TreeGridField idField = new TreeGridField("TicketID", "Ticket ID");
TreeGridField parentField = new TreeGridField("ParentID", "Parent ID");
grid.setFields(idField, parentField);
MyDS ticketDS = new MyDS("tickets");
TreeNode node1 = new TreeNode();
node1.setAttribute("TicketID", 1);
/*Integer nullParent = null;
node1.setAttribute("ParentID", nullParent);*/
TreeNode node2 = new TreeNode();
node2.setAttribute("TicketID", 2);
node2.setAttribute("ParentID", 1);
ticketDS.addData(node1);
ticketDS.addData(node2);
grid.setDataSource(ticketDS);
grid.setAutoFetchData(true);
this.addMember(grid);
}
private class MyDS extends DataSource {
public MyDS(String id) {
super(id);
setClientOnly(true);
DataSourceIntegerField ticketId = new DataSourceIntegerField("TicketID", "Ticket ID");
ticketId.setPrimaryKey(true);
DataSourceIntegerField parentId = new DataSourceIntegerField("ParentID", "Parent ID");
parentId.setForeignKey("TicketID");
setFields(ticketId, parentId);
}
}
}
Comment