Skip to Content

sap.ui.table - getSelectedIndices()

Jun 29, 2017 at 03:03 PM


avatar image


I am working with sap ui table with multi selection possibility. I would like to access the data related to the user selected rows (I want to do it using getContextByIndex(rowIndex)).

I am using oTable.getSelectedIndices() to get the indices of rows selected by the user. But, somehow the indices are not the correct indices of the selected rows from the table and so I get the wrong data from the context binding.

I understand that this is because If the selected row is not with in the visible row count.

How can I get the correct / actual indices of the selected rows from the table ?

It would be great If I get some help or hints on this. Thank you :)

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

2 Answers

Best Answer
Vikram Kumar Thallapaneni Jun 29, 2017 at 06:03 PM

Hello Guys,

I have been researching around. I think, I have identified the issue after reading the below blog.

The issue was because of the scrollbar and it didnt allow to scroll until the last row(all the available rows) of the table. This can happen because of the parameters which are used to calculate the scrollbar length. One of such is: variable row height.

If the content of the rows in the table has different heights, then the scrollbar length is not set correctly. So, we see this different behaviour while scrolling.


I have given a fixed row height in the table definition. Now, I could scrolldown all the available rows(until last row). With this, the selected row indices are fetched correctly.

Please let me know If I am leading in a wrong direction. Thank you :)

10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jun 30, 2017 at 01:21 PM


you can get with

			var oList = new sap.m.List();
			oList = this.getView().byId("tableId");
			var obj = oList.getSelectedItems();
Show 1 Share
10 |10000 characters needed characters left characters exceeded


Thanks for your solution.

I think, your answer is totally in other direction.

My question was related to sap.ui.table. I think you solution might be for sap.m.table.

But anyhow, I was able to find the solution and please see my answer for my exact problem.