cancel
Showing results for 
Search instead for 
Did you mean: 

Bind Association XSOData in UI5?

0 Kudos

Let's say I have Employee entity associated with Address entity in XSOData and I want to bind them to a single control - StandardListItem. How to achieve this?

<List id="EmployeeList" headerText="Employees" items="{ path: '/Employee'}">
  <items>
    <StandardListItem title="{Name}" //from Employee entity
                      description="{Address}" //from Address entity
    />
  </items>
</List>

Associated address details available at Employee('emp1')/Address/


TIA.

Accepted Solutions (1)

Accepted Solutions (1)

pfefferf
Active Contributor

You have to add a binding specific parameter that the associated Address is expandend. Then you can access the properties of the Address via "Address/<property name>" (e.g. Address/City - if "City" is a valid property of course).

<List id="EmployeeList" headerText="Employees" items="{ path: '/Employee', parameters: { expand: 'Address'} }">
  <items>
    <StandardListItem title="{Name}" //from Employee entity
                      description="{Address/City}" //from Address entity
    />
  </items>
</List>

If you wanna combine different Address properties for your description field you can use expression binding or the parts syntax.

Regards,
Florian

0 Kudos

Thanks for the response, Florian. It worked.

The $expand option is what I needed.

Thanks, again.

Answers (0)