Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

multiLevel IPickTreeItem showing wrong display value

$
0
0
Hi -
I'm using the 4.1p release of SmartGWT and I have a multilevel IPickTreeItem linked with a Parent TreeModelType. The first level of the tree displays correctly, but the 2nd level shows the "id" field instead of the DisplayField. I've included a test case below, and while I'd expect to see:
parent --> child1
I get:
parent --> 2

Am I doing something wrong? Or is this an issue with the framework? If I change the parentId attribute of the 2nd node to 0, I get:

parent
child1

as expected.
Code:

                DynamicForm Form = new DynamicForm();
                final IPickTreeItem PickTree = new IPickTreeItem("PickTree");
                PickTree.setDisplayField("Name");
                PickTree.setValueField("Value");
                PickTree.setCriteriaField("Value");
                Form.setID("Form");
                TreeNode parent = new TreeNode();
                parent.setAttribute("id", 1);
                parent.setAttribute("parentId", 0);
                parent.setAttribute("Name", "parent");
                parent.setAttribute("Value", "parentValue");
                TreeNode child1 = new TreeNode();
                child1.setAttribute("id", 2);
                child1.setAttribute("parentId", 1);
                child1.setAttribute("Name", "child1");
                child1.setAttribute("Value", "value1");
                Tree menuTree = new Tree();

                menuTree.setParentIdField("parentId");
                menuTree.setIdField("id");
                menuTree.setModelType(TreeModelType.PARENT);
                menuTree.setRootValue(0);
                menuTree.setData(new TreeNode[] { parent, child1 });
                PickTree.setValueTree(menuTree);

                PickTree.setWidth(150);
                PickTree.setShowTitle(false);
                PickTree.setCanSelectParentItems(true);

                Form.setFields(PickTree);

                Form.draw();


Viewing all articles
Browse latest Browse all 4756

Trending Articles