Skip to Content
0

Bind Association XSOData in UI5?

Nov 04, 2017 at 08:31 PM

50

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Florian Pfeffer
Nov 05, 2017 at 09:44 AM
1

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

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

Thanks for the response, Florian. It worked.

The $expand option is what I needed.

Thanks, again.

0