Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.ui.commons"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div id="content"></div>
</body>
</html>
 
var oItemsData = {
  items: [
    { key: "American", text: "American"},
    { key: "Hopkins", text: "Hopkins" },
    { key: "Horner", text: "Horner" },
    { key: "Thornton", text: "Thornton" },
    { key: "Walters", text: "Walters" }
  ]
};
var oValueData = {
  selected: "Horner"
};
var oItemsModel = new sap.ui.model.json.JSONModel(oItemsData);
var oValueModel = new sap.ui.model.json.JSONModel(oValueData);
sap.ui.getCore().setModel(oItemsModel, "items");
sap.ui.getCore().setModel(oValueModel, "values");
var oDropDown = new sap.ui.commons.DropdownBox({
  items: { 
    path: "items>/items",
    template: new sap.ui.core.ListItem({
      key: { path: "items>key" },
      text: { path: "items>text" }
    }) 
  },
  selectedKey: { path: "values>/selected"}
});
oDropDown.placeAt("content");
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers