Skip to Content
avatar image
Former Member

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

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?

P.S:

  1. This is not about one-way or two-way binding.
  2. Product and Supplier do not have a Parent - Child relationship
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 17, 2017 at 06:54 AM

    Hello,

    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,

    Joseph

    Add comment
    10|10000 characters needed characters exceeded

    • 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 ;)

  • 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.

    Add comment
    10|10000 characters needed characters exceeded