Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Issue with binding

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>

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question