Skip to Content

How to bind two models to one control(UI5 Grid table)?

Nov 16, 2017 at 10:34 PM


avatar image
Former Member

My page has a UI5 Grid Table Control and it contains the following columns

  • Product Name
  • Product ID
  • Supplier Name
  • Supplier ID

Product and Supplier are two different entities which I fetch using different ODATA calls. (/Product and /Supplier) . The Product entity has Supplier ID as a foreign key. How would I display values from these entities in one single Grid Table?


  1. This is not about one-way or two-way binding.
  2. Product and Supplier do not have a Parent - Child relationship
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Joseph BERTHE Nov 17, 2017 at 06:54 AM


Redefine you OData model. I mean, create a Parent entity which contain properties :

  • Primary key (id or orther)
  • Product ID
  • Supplier ID

Then, create two children entities which refer to Product and Supplier. Then create an association (in the both way) for each ID (Product and Supplier).

For instance you Product entity should looks like this :

  • Product ID (the key)
  • Product Name

At the end, the request should looks likes this :

  • <path_to_serveur>/YOUR_SERVICE/ParentEntity?$expand=Products,Suppliers

Kind regards,


Show 5 Share
10 |10000 characters needed characters left characters exceeded

what's the point? still two separate entity, how can he display them in one table?


easy :)

In fact you have 3 entities types but never mind. The point is with expand property you can merge data. Look at this example :

In the view :

<mvc:View controllerName="ch.saphir.demo.expand.Demo_Expand_Table.controller.View1" xmlns:html=""
    xmlns:mvc="sap.ui.core.mvc" displayBlock="true" xmlns="sap.m">
    <App id="idAppControl">
            <Page title="{i18n>title}">
                    <Table noDataText="Drop column list items here and columns in the area above" id="__table0"
                            <ColumnListItem >
                                    <Text text="{MatlDesc}"/>
                                    <Text text="{Units/Isotxt}"/>
                            <Column ><Text text="Material"/></Column>
                            <Column ><Text text="Unit Text"/></Column>

Here Units is the navigation to the text of the Unit Code, and I call the expand in the parameters of the table Items aggregation.

In OData point of view, look at my screenshot :


gw-info.png (284.0 kB)

why not just conbine to one? why complicate it with association?


In my point of view it is not more complicated, it is data modeling. Don't forget one thing, if we want to create simple application with Fiori concept, we need absolutely to take care of the data model. In that manner it will be very easy to reuse model and create hudge constellation of simple Fiori elements application combined with Fiori launchpad, you get the right things ;)


Which binding do you want? I don't have coding anything for this. Only XML binding + Default OData model, that all.

Jun Wu Nov 17, 2017 at 02:24 AM

combine them to one entity and expose as service

ui control can be bound to n model, but it won't help for your case.

10 |10000 characters needed characters left characters exceeded