cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Table row index issue

Former Member
0 Kudos

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.

Thanks,

Venkatesh

Accepted Solutions (0)

Answers (1)

Answers (1)

Sharathmg
Active Contributor
0 Kudos

Check this blog for your issues:

https://blogs.sap.com/2014/04/08/understanding-sapuitabletable-in-10-minutes/

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

Regards,

Sharath

Former Member
0 Kudos

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({
					id:"arBtn",
					buttons:[
						    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
					})
				});
		colList.push(oAction);

capture.png

Thanks,

Venkatesh

Sharathmg
Active Contributor
0 Kudos

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?

Regards,

Sharath