on 2014 Feb 04 9:40 AM
I am trying to run this example but some how just cant
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons"
data-sap-ui-theme="sap_goldreflection">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
$(document).ready(function()
{
var data =
{
company:
{
properties: [
{value: "Hello"},
{value: true},
{value: 45},
]
}
}
var oModel = sap.ui.model.json.JSONModel();
oModel.setData(data);
sap.ui.getCore().setModel(oModel);
var oContainer = new sap.ui.core.ComponentContainer("oContainer", {
name: "oContainer",
settings: {text: "Hello World 2"}
});
alert("...");
oContainer.bindAggregation("content", "/company/properties", function(sId, oContext)
{
var value = oContext.getProperty("value");
switch(typeof value)
{
case "string":
return new sap.ui.commons.TextField(sId, {
value: {
path: "value",
//type: new sap.ui.model.type.String();
}
});
case "number":
return new sap.ui.commons.TextField(sId, {
value: {
path: "value",
// type: new sap.ui.model.type.Float();
}
});
case "boolean":
return new sap.ui.commons.CheckBox(sId, {
checked: {
path: "value"
}
});
}
});
});
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
After some debug via fireBug, I saw it threw errors with code lines that look like:
type: new sap.ui.model.type.
So I commented them out..
However theres another error now that says:
Aggregation "content" does not exist in Element sap.ui.core.ComponentContainer#oContainer
Whats it that I am doing wrong here...
Thanks for all your help ...
Amjad
Request clarification before answering.
Hey Jason,
I figured that out
The oContainer in the sample should not refer to the ComponentContainer as it doesnt have the property "content"
It should rather refer to some component that has one .. such as sap.ui.commons.Panel
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.