on 10-09-2015 7:15 AM
Hi,
I am facing some issue with UI binding on my view.
I have an sap.m.Table control in my xml view which I am trying to populate with some sample data in the onInit method of the controller.
But the table is rendered empty.. Could you please suggest what I am missing!!
This is my onInit method:
onInit: function(){ | |||||
var mappingCollection = []; | |||||
var singleMapping = { "targetField": "Sample Target Field", "sourceField": "Some Source Field"} | |||||
mappingCollection.push(singleMapping); | |||||
var oMappingModel = new JSON(); | |||||
oMappingModel.setProperty("/mapping",mappingCollection); | |||||
sap.ui.getCore().setModel(oMappingModel, "mappingModel"); | |||||
}, |
This is my XML view Table control:
<Panel class="sapUiResponsiveMargin" width="auto">
<Table id="mappingTable"
items="{mappingModel>/mapping}">
<headerToolbar>
<Toolbar>
<Label text="Mapping"/>
</Toolbar>
</headerToolbar>
<columns>
<Column width="12em">
<Text text="Target Field" />
</Column>
<Column width="12em">
<Text text="Source Field" />
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{mappingModel>targetField}" valueLiveUpdate="true"></Text>
<Text value="{mappingModel>sourceField}" valueLiveUpdate="true"></Text>
</cells>
</ColumnListItem>
</items>
</Table>
</Panel>
Hi Parul,
Include data-sap-ui-xx-bindingSyntax="complex" in SAPUI5 bootstrap.
And also Text doesn't have a value property, you have to use Input control for the same.
I used your code, check the working sample - JS Bin - Collaborative JavaScript Debugging
Regards,
Sai Vellanki.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Parul,
I think in your bootstrap data-sap-ui-xx-bindingSyntax="complex" is not included.
Check your bootstrap, it should be -
<script id="sap-ui-bootstrap"
type="text/javascript"
src="/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-libs="sap.m"
data-sap-ui-xx-bindingSyntax="complex">
Regards,
Sai Vellanki.
Hi Sai,
I do have data-sap-ui-bindingSyntax = "complex" in my bootstrap, but without the xx.
I made this work by setting the model on the view controller itself instead of the core and moving the table and other stuff I had on a single view, but I am not quite sure why it didn't work for me earlier.
I guess I will start from a clean slate again tomorrow.
Thanks,
Parul
Hi Parul,
Do you see the data in the model in debugging mode?
Why not do something like this - SAPUI5 SDK - Demo Kit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.