Hi friends,
I want to create a ComboBox with a Tree structure options.
Here is the code but doesn't work:
//create the Tree control
var oTree = new sap.ui.commons.Tree("tree");
oTree.setTitle("Explorer");
oTree.setWidth("100%");
oTree.setHeight("auto");
oTree.setShowHeaderIcons(true);
oTree.setShowHorizontalScrollbar(false);
//create Tree Nodes
var oNode1 = new sap.ui.commons.TreeNode("node1", {text:"Computer", icon:"images/system.gif", expanded: true});
var oNode2 = new sap.ui.commons.TreeNode("node2", {text:"OSDisk (C:)", icon:"images/disk.gif", expanded: true});
var oNode3 = new sap.ui.commons.TreeNode("node3", {text:"Program Files", icon:"images/folder.gif"});
var oNode4 = new sap.ui.commons.TreeNode("node4", {text:"Windows", icon:"images/folder.gif"});
var oNode5 = new sap.ui.commons.TreeNode("node5", {text:"Mass Storage (USB)", icon:"images/disk.gif"});
var oNode6 = new sap.ui.commons.TreeNode("node6", {text:"Network", icon:"images/network.gif"});
oNode1.addNode(oNode2);
oNode1.addNode(oNode5);
oNode2.addNode(oNode3);
oNode2.addNode(oNode4);
//add Tree Node root to the Tree
oTree.addNode(oNode1);
oTree.addNode(oNode6);
// Create a ComboBox
var oComboBox2 = new sap.ui.commons.ComboBox("ComboBox2", {tooltip:"City", displaySecondaryValues:true, value:"Walldorf", "association:Tree" : oTree});
Could you help me or give me some advice?
Thank you!