cancel
Showing results for 
Search instead for 
Did you mean: 

sap.ui.table - getSelectedIndices()

0 Kudos

Hello,

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 🙂

Accepted Solutions (1)

Accepted Solutions (1)

Hello Guys,

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

https://github.com/SAP/openui5/issues/320

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.

Solution:

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 🙂

Answers (1)

Answers (1)

eyup_aksoy
Explorer
0 Kudos

Hi

you can get with

			var oList = new sap.m.List();
			oList = this.getView().byId("tableId");
			var obj = oList.getSelectedItems();
0 Kudos

Hello....

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.