cancel
Showing results for 
Search instead for 
Did you mean: 

sap.ui.table repeats last row from oData service

Former Member
0 Kudos

hi all,

i've some very strange behavior from sap.ui.table control.

i've two different views, view1 & view2 both are search functionalists. so on search i will collect the input field values and provide them while table.bindRows("/EntitySet",null.null, filters);

view1 - has been implemented without any issues

view2 - i've some strange issue here, i receive the proper/expected response from oData service when checked in F12 (chrome). but when it renders into table.. it only shows the last row being repeated in all the rows.

lets say i get 5 rows as output response (json response seen in F12) -> the table shows 5 rows (which is correct) but it just shows/repeats the 5th (last) row for five times. not sure where the issue is.. as both the views are being coded as same in controllers. both views (xml files) are same except that the layout controller is different (one view1 is MatrixLayout, view2 is SimpleForm with ResponsiveLayout). otherwise i dont see any changes in the coding.

does anyone faced such issue before, wt is that causing this last row being repeated to the total no of rows as response? any pointers?

Accepted Solutions (1)

Accepted Solutions (1)

maximilian_lenkeit
Participant

This sounds as if the entities that are returned through OData all have the same key.

The OData models manages its data in a map where the actual record is mapped to the key. If there is a second record with the same key, it will overwrite the data of the first record, and so on. Eventually, there might only be on distinct key, thus, the table would display only that one record.

To verify, look at the OData metadata and find out that is key of the entity that you're displaying. Then, look into the response with e.g. the Chrome DevTools and check whether the keys that are returned from the backend are unique. They probably aren't

- Max

Former Member
0 Kudos

hey Max, your answer makes lot of sense to me. working on changes for oData... would update you back!

Message was edited by: SAP Box

Former Member

Max, u r awesome! its a perfect answer. appreciate your response as it worked. my key was not unique, and made new attribute uId as key+unique.

Answers (2)

Answers (2)

0 Kudos

Thanks Maxi, your answerer helped me to get the resolve my issue , thankyou so much.

Former Member
0 Kudos

Awesome answer ...i was struggling in this case but finally resolve by the help of Maximilian Lenkeit thanks maxi