Hello all,
while working through UI5 i came across a question regarding the architecture of models. I have the following scenario:
- An Odata service with 3 Entitysets lets call them A,B,C
- Entity A has the following properties(ID, Name) and an navigationpath to B
- B has as properties(ID and Title) and a navigationpath to C
- C has ID and Status
- All ID's are unique, no foreign key relation and the paths are bidirectional
- I want to Display a sap.m.List with the data from Entity A(no problem there)
- Now if i click on a List Entry i want to display the Status from C
Here is where my problems start. my List is bound to Entity A
<m:List headerText="People" id="PeopleList" items="{A>/People}">
But how can i handle the Binding of the Object Status when i click on the List?
<m:ObjectListItem press="changeStatus" title="{A>DisplayName}" type="Active">
<m:firstStatus>
<m:ObjectStatus state="????????????????????????" text="????????????????????" />
</m:firstStatus>
What i need to do in OData terms would be an roughly something like ../A(123)$expand(b, c)&$select(status)
But that i can't bind to the Object Status, so i am a little lost how you would accomplish something like that in JS?
Basically when i click on the listitem i need to return a state = "Error" or "Success" and some Text.
Would it be better to have a temporyry model(JSON e.g.) and bind that to the List or what would be a clean way to handle this?
I hope i made myself clear, if not please don't hesitate to ask questions.
Regards
Mathias Märker