cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 oData Binding

Former Member
0 Kudos

Hello,

I'm currently at a point where I dont get, how I can get on.

I have some code like this:

Could someone explain me in detail how I can use two different Entity Sets within one Page?

Many thanks in advance

Best regards

Johannes

Accepted Solutions (1)

Accepted Solutions (1)

Sharathmg
Active Contributor
0 Kudos

Entity is like a data set which holds the values in variables/properties. You first say that which is the dataset i.e. entity for the table. Then, bind the properties in that entity to the columns or rows in the table. In a view XML, you can map only one entity set for a control.

If you want to use data from multiple entities, then you have to manually set the properties to the controls in the table.

Regards,

Sharath

Former Member
0 Kudos

Hi,

thx for you answer.

The binding works via <table [...] items="{XY}">.

All data is now visible.

Is it also possible to filter this data to only see the relevant data based on the atm viewed detail page?
I'm pretty sure this is only possible with the help of the controller, but I cant get it going.

best regards

Johannes

Sharathmg
Active Contributor
0 Kudos

You can append the filters to the entity. You can choose to do it in XML(if the filters are static) else in the controller.

// bind aggregation
table.bindAggregation("rows",{ path:"/<entity>", filters:[filter string]..}); 

Regards,

Sharath

Former Member
0 Kudos

Hi,

thx for input, your answer got me further.

Now I'm trying to get that filter dynamic with the help of some controller logic. But it keeps saying that there is no template for the aggregation, even though I wrote one. Any idea?

Sharathmg
Active Contributor
0 Kudos

Check with sample codes. The code used to bind templates seems wrong.

Former Member

Hi,

i got the issue solved today. Thank you a lot for your patience and answers.

The reason was that there was no navigation property/association between the detaildata and the masterlist data in the oData Service. I got it this morning.

Best regards

Johannes

Answers (2)

Answers (2)

SergioG_TX
Active Contributor
0 Kudos

think of the Entities as lists or properties of an object.

Supposed you have a model which contains a simple property (name), and a complex property (addresses). Think about addresses for a second. Addresses is a list of Address. Further, Address is a complex object itself probably composed of Street, City, State, Country, etc.

so if you had a list of address, then you would bind your UI list control with the Addresses (to bind the root) and then each Address item could have text properties of the Address properties (Street, City, State, Country), etc.

(pseudo code for simple explanation)

<List items="{Addresses}"> <!-- this line binds the list -->

<ObjectItem>

<Text text="{Street}, {State}" /> <!-- notice you can also put multiple properties on the same property binding -->

<Label text="{Country}" />

</ObjectItem>

</List>

hope this helps understand the binding... also, please take a look at the sapui5 explored tab - aggregation binding

saurabh_vakil
Active Contributor
0 Kudos

I can see that in the Table with id incidentList you are binding fields from the entity set 2, but where have you bound the entity set 2 with the table? Without providing a binding path to the required entity set in the table it is not possible to bind fields from the entity set inside the cells of the table.