0

I am creating an OData model in SAP Netweaver. I have an entity which represents some node in a tree-like structured model. Each entity has its own identifier and also has the identifier of its unique parent( if one exists). I have created 2 associations, one 0 to M from a node to its children, and one 0 to 0 from a node to its parent. Everything works rather good But I am stuck with binding details of the parent in an xml view which is bound to a child. Here is in detail what i have and what i want to achieve

a) I bind the xml view with a distinct node of my model. It works fine and I can call properties of the node within this view with their relative names. b) The view uses a standard sap.m.Page, and in text i try to bind the following

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

when the view is shown the description of the parent is missing. I have checked the odata service link and when i put the suffix /PARENT/DESCRIPTION to a node I get the correct answer.

So in general my question is if one has an 1 to 1 association in an OData model, how can one do data binding in text fields of sapui5 xml views.

I know I could simply program in the controller to read this properties and set the text, or maybe even try with a formatter but those options seem to be very ugly and unnecessary.

Thank you for your responses

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 Jul 12 '21 at 15:35

1 Answers1

0

Assuming that "parent" is a NavgiationProperty of the bound object:

Maybe the Parent-Data are not loaded. Try it with using the $expand property to your View-binding

this.getView().bindElement({
            path: <yourObjectPath>,
            parameters : {
               expand : "Parent"
            }
        });
Khaos
  • 164
  • 7