Skip to Content

SAPUI5 Table row index issue

Jul 19, 2017 at 06:44 PM


avatar image
Former Member

Hi All,

Can someone help me getting the index on selection of row?

I am able to get the index but the issue is visible row index is getting fetched on row click event.

For example:

Actual Row number in the column is 17.

As I have made visible row count to 5, the values when scrolled down, on click of the button event (image column), the index is coming between 0 to 4 only.

I am using Sap.ui.table.

Any help on this is much appreciated.



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

1 Answer

Sharath M G Jul 20, 2017 at 07:58 AM

Check this blog for your issues:

Also, try to bind an event handler for the event rowSelectionChange. In this method, you should get the index in the data set.



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

Hi Sharath, thank you so much for responding. :)

It's already working based on rowSelectionChange.

I have got the index through getContextByIndex but the challenge is with the segmented button in my table which will be resolved if the button gets refreshed after the user takes the action. Please see the attached image.
So, the issue is "index of the Segmented Button" in the table is not getting fetched properly.

Table is getting refreshed but the button which is pressed is staying as it is like shown in the image even after scrolling away from the record (scrolling down I mean).

Here is the code of the column:

		var oAction = new sap.ui.table.Column({
				label: new sap.ui.commons.Label({text: "Action"}),
				template: new sap.ui.commons.SegmentedButton({
						    new sap.ui.commons.Button({id:"BtnApr",text:"{Action}", style:sap.ui.commons.ButtonStyle.Accept}),
						    new sap.ui.commons.Button({id:"BtnRej", text:"{ActionRej}", style: sap.ui.commons.ButtonStyle.Reject})
					select : oController.segmentBtn




capture.png (2.3 kB)

sap.ui.commons.segmentedbutton is deprecated. So please use sap.m.segmentedbutton.

Meanwhile, what is the actual requirement? Is it to refresh the buttons? or Is it to get the selected button?