cancel
Showing results for 
Search instead for 
Did you mean: 

Get the row index of sap.m.table

former_member200477
Participant
0 Kudos

Hello,

I have an application in which i have an sap.m.table with an input with value help. the table looks like this

Here Country is the input field with value help. How can i get the index of the row for which the value help is opened?

For example: If i select value help from Sl No 3, i should get row index as 3.

Can anyone please help me with the code.

Thank you,

Navya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can try this:

change: function(oEvent){

     oEvent.getSource().getParent().getCells()[0].getText();

}

Kind regards,

RW

santhu_gowdaz
Active Contributor
0 Kudos

var parts = oEvent.getSource().getId().split("-");

                    var rowNum = parseInt( parts[2].substring(3, parts[1].length) );

see this exampleJS Bin - Collaborative JavaScript Debugging</title> <link rel="alternate" type=&q...

Former Member
0 Kudos

If you want the binding (path):

oEvent.getSource().getBindingContext()

                                .getPath();

Answers (1)

Answers (1)

former_member200477
Participant
0 Kudos

Thanks a lot Robbe. I got exactly what i wanted.

Santhosh: oEvent.getSource().getId().split("-") gives me the id of the input. As i have the input in the table, the id of the input changes every time i make some changes in the field. Hence i cannot consider the id. Instead i wanted the path. Thank you for the help.

Thank you,

Navya