0

I have encountered a problem while binding my OData service to a ListItem in SAPUI5. To demonstrate my problem, let's consider this simple OData service:

Task: {
  ID: '100',
  Name: 'TaskName'
  Parent: {
    ID: '10',
    Name :'ParentName'
  }
}

I tried binding my controller to the service, but i can only retrieve the "ID" value of the text parameter, if i try to do a relative binding (in this case : to retrieve the Parent's ID), it doesn't seem to work..

<List items="{/Task}">
  <CustomListItem>
    <Button text="ID" tooltip="{Parent/ID}"/>
  </CustomListItem>
</List>
Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
  • Does this answer your question? [How to make use of navigation property?](https://stackoverflow.com/questions/52483541/how-to-make-use-of-navigation-property) – Boghyon Hoffmann Aug 21 '20 at 11:51
  • As suggested in the above linked answer, what you need is a navigation property with which you can do `tooltip="{ToParent/ID}"` whereas `"ToParent"` is the name of the navigation property to a single entity (not a collection). – Boghyon Hoffmann Aug 21 '20 at 11:58

2 Answers2

1
Task: [{
      ID : '100',
      Name :'TaskName'
      Parent :{
               ID :'10'
               Name :'ParentName'
              }
     }]
Jun Wu
  • 35
  • 1
  • 9
-1

Try with <Button text="ID" tooltip="/Parent/ID"/>. Observe "/" before Parent node.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
SriniRao
  • 59
  • 4
  • 11