Skip to Content
avatar image
Former Member

How to bind in sapui5 a navigation property

Hi all,

I have a tree-like odata model where each node has a unique own identifier, possibly a unique identifier of its parent(if it has one) and of course some other description properties. I have created a navigation property "PARENT" which gives back the parent of a node. I have checked that the navigation works correctly by checking the service url. so when i append "/PARENT" to the service url i do get back correctly the parent.

What i want to do is the following. I have an xml view which i bind to a fixed node, the binding works for the normal properties of the node, like its id or description, but i can figure out how to use binding in the xml view to get the parent. So I want to do sth like:

<Page text="{DESCRIPTION} {PARENT/DESCRIPTION}">

... contents of the page

</Page>

Now the DESCRIPTION is bound properly but he PARENT/DESCRIPTION is missing. I could get it by coding in the controller or maybe by creating a formatter, but I would prefer to have a simple solution like above. Does anyone know how I could achieve this binding of a navigation property?

Thanks in advance

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Dec 12, 2017 at 11:06 AM

    Someone already gave me the answer. I should enhance the bindElement in the init function to have: parameters {expand: "PARENT"}

    https://stackoverflow.com/questions/47758844/sap-odata-binding-an-n-to-1-association-to-a-text-field-in-sapui5

    Add comment
    10|10000 characters needed characters exceeded