Hi,
I am just trying to make a treegrid work with local dummy data and then later on to make it work with GWT-RPC. But my first try with local data fails, can someone please point me out why?
Here is the code to make the tree
Here is my own TreeNode
and here is the exception
Any advice? What am i doing wrong here?
I am just trying to make a treegrid work with local dummy data and then later on to make it work with GWT-RPC. But my first try with local data fails, can someone please point me out why?
Here is the code to make the tree
Code:
final TreeGrid dbTree = new TreeGrid(); dbTree.setLoadDataOnDemand(false); dbTree.setWidth(200); dbTree.setHeight100 (); dbTree.setAutoFetchData(false); dbTree.setShowConnectors(true); dbTree.setShowOpenIcons(false); dbTree.setShowDropIcons(false); dbTree.setClosedIconSuffix(""); TreeGridField field = new TreeGridField("Name", "DB Control"); field.setCanSort(false); dbTree.setFields(field); final Tree tree = new Tree(); tree.setModelType(TreeModelType.PARENT); tree.setNameProperty("Name"); tree.setIdField("NodeId"); tree.setParentIdField("ParentNodeId"); tree.setShowRoot(true); DBControlTreeNode root = new DBControlTreeNode ("1", "1", "TABLE"); DBControlTreeNode node2 = new DBControlTreeNode ("2", "1", "TABLE-1"); DBControlTreeNode node3 = new DBControlTreeNode ("3", "1", "TABLE-2"); DBControlTreeNode node4 = new DBControlTreeNode ("4", "1", "TABLE-3"); DBControlTreeNode node5 = new DBControlTreeNode ("5", "1", "TABLE-4"); tree.setData(new TreeNode[]{root, node2, node3, node4, node5}); dbTree.setData (tree);
Code:
public static class DBControlTreeNode extends TreeNode { public DBControlTreeNode(String objectId, String parentId, String name) { setNodeId(objectId); setParentNodeId(parentId); setName(name); } public void setNodeId(String value) { setAttribute("NodeId", value); } public void setParentNodeId (String value) { setAttribute("ParentNodeId", value); } public void setName(String name) { setAttribute("Name", name); } }
Code:
Uncaught JavaScript exception [com.google.gwt.core.client.JavaScriptException: (TypeError): Object expected number: -2146823281 description: Object expected at com.smartgwt.client.util.JSOHelper.setAttribute(Native Method) at com.smartgwt.client.core.BaseClass.getOrCreateJsObj(BaseClass.java:86) at com.smartgwt.client.widgets.tree.TreeGrid.setData(TreeGrid.java:183)
Comment