Skip to Content
0

UI5 oData Binding

Jul 19, 2017 at 02:21 PM

188

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Sharath M G Jul 20, 2017 at 07:13 AM
0

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

Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

0
Former Member

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?

template.png (19.7 kB)
0

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

0
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

1
saurabh vakil Jul 20, 2017 at 06:00 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Sergio Guerrero Jul 25, 2017 at 02:36 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded