Last active
August 29, 2015 14:04
-
-
Save qmacro/973aea751b00654b399a to your computer and use it in GitHub Desktop.
Keyed vs Non-Keyed Root JSON Element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta charset="UTF-8"> | |
<script id="sap-ui-bootstrap" | |
type="text/javascript" | |
src="/sapui5/latest/resources/sap-ui-core.js" | |
data-sap-ui-theme="sap_bluecrystal" | |
data-sap-ui-libs="sap.m" | |
data-sap-ui-xx-bindingSyntax="complex"> | |
</script> | |
<script id="view1" type="sapui5/xmlview"> | |
<mvc:View | |
controllerName="local.controller" | |
xmlns:mvc="sap.ui.core.mvc" | |
xmlns:core="sap.ui.core" | |
xmlns="sap.m"> | |
<MultiComboBox | |
id="mcb" | |
placeholder="Please choose one or more categories" | |
items="{/}"> | |
<core:Item | |
key="{Category}" | |
text="{CategoryName}" /> | |
</MultiComboBox> | |
</mvc:View> | |
</script> | |
<script> | |
sap.ui.controller("local.controller", { | |
onInit : function(oEvent) { | |
var sURL = "/sapui5/latest/test-resources/sap/m/demokit/cart/model/ProductCategory.json"; | |
var oModel = new sap.ui.model.json.JSONModel(sURL); | |
this.getView().setModel(oModel); | |
} | |
}); | |
var oView = sap.ui.xmlview({ viewContent: jQuery('#view1').html() }); | |
oView.placeAt("content"); | |
</script> | |
</head> | |
<body class="sapUiBody" id="content" /> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
<meta charset="UTF-8"> | |
<script id="sap-ui-bootstrap" | |
type="text/javascript" | |
src="/sapui5/latest/resources/sap-ui-core.js" | |
data-sap-ui-theme="sap_bluecrystal" | |
data-sap-ui-libs="sap.m" | |
data-sap-ui-xx-bindingSyntax="complex"> | |
</script> | |
<script id="view1" type="sapui5/xmlview"> | |
<mvc:View | |
controllerName="local.controller" | |
xmlns:mvc="sap.ui.core.mvc" | |
xmlns:core="sap.ui.core" | |
xmlns="sap.m"> | |
<MultiComboBox | |
id="mcb" | |
placeholder="Please choose one or more categories" | |
items="{/ProductCategories}"> | |
<core:Item | |
key="{Category}" | |
text="{CategoryName}" /> | |
</MultiComboBox> | |
</mvc:View> | |
</script> | |
<script> | |
sap.ui.controller("local.controller", { | |
onInit : function(oEvent) { | |
var sURL = "/sapui5/latest/test-resources/sap/m/demokit/cart/model/ProductCategory.json"; | |
var oModel = new sap.ui.model.json.JSONModel(sURL); | |
oModel.attachEventOnce('requestCompleted', function(oEvent) { | |
var oModel = oEvent.getSource(); | |
oModel.setData({ | |
"ProductCategories" : oModel.getData() | |
}); | |
}); | |
this.getView().setModel(oModel); | |
} | |
}); | |
var oView = sap.ui.xmlview({ viewContent: jQuery('#view1').html() }); | |
oView.placeAt("content"); | |
</script> | |
</head> | |
<body class="sapUiBody" id="content" /> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment