Skip to Content

Multi Model support in SAP UI5


I am new to SAP UI5 and would like to know what mistake I am doing when using multi Models(JSON) in my app.

I have two JSON models : Address and Payments.

The structure of my app where these files are stored is :



Inside the Contoller I have onInit function which has following Code:

var oModel1 = new JSONModel("NSProject_Table.model", "/Address.json"));

var oModel2 = new JSONModel("NSProject_Table.model", "/Payments.json"));

The XML View has two controls : ComboBox(uses Address) and Table(Payments):

<ComboBox id="Combo1" showSecondaryValues="true" items="{ path: 'oModel1>/Address', sorter: { path: 'Name' }}">
<core:ListItem key="{/Name}" text="{/street}" additionalText="{/City}"/>

<Table id="idProductsTable" inset="false" items="{ path: 'oModel2>/Items', sorter: { path: 'DocNo' } }">
<Title text="Products" level="H2"/>
<Column width="12em"><Text text="Doc No"/></Column>
<Column minScreenWidth="Tablet" demandPopin="true"><Text text="Main"/></Column>
<Column minScreenWidth="Tablet" demandPopin="true"><Text text="Sub"/></Column>
<Column minScreenWidth="Tablet" demandPopin="true"><Text text="Description"/></Column>
<Column hAlign="Right"><Text text="Amount"/>

<Text text="{DocNo}"/>
<Text text="{Main}" width="20%"/>
<Text text="{Sub}"/>
<Text text="{Desc}"/>
<Text text="{Amount}"/>

The comboBox and the table show blank rows but the number of blank rows is the same as the number of address and the payments items. Do you know why I am seeing blank rows?

Also If I try to access using absolute Path like {oModel1>/Address/0/Name} for a text field it works, but when using in Combox and table using oModel1>/ and oModel2>/ it does not work.

Any pointers will be really appreciated.


Govind Parmar

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Posted on Feb 16, 2017 at 01:50 AM


    I am going with a few assumptions (which i will state) because your json structure is not known. Your Address.json has the following structure

    {Address : [
         Name : "Name1",
         Street : "Street1"
         City : "City1"
        },          {
              Name : "Name1",
              Street : "Street1"
              City : "City1"

    Then your binding in combobox needs to

    <ComboBox id="Combo1" showSecondaryValues="true" items="{ path: 'oModel1>/Address', sorter: { path: 'Name' }}"><core:ListItem key="{oModel1>Name}" text="{oModel1>street}" additionalText="{oModel1>City}"/></ComboBox>

    Observe that Slash(/) has been removed from binding and modelname has been prefixed. aggregation binding puts the Listitem at oModel1>/Address/0/ and /Address/1/ and so on. You need to mention only the name of the attribute but prefix with model identifier.

    Similarly your table looks fine from the binding perspective just prefix the named model in the attributes as well. This should fix it.

    Thanks and Regards,


    Add comment
    10|10000 characters needed characters exceeded