cancel
Showing results for 
Search instead for 
Did you mean: 

How to get index of a row on click of value help request in sap.m.table?

Former Member
0 Kudos

Hello,

I am trying to get the index of a row in sap.m.table when user clicks on the value help request icon in a multinput control as highlighted below.

I have used sap.ui.comp.valuehelpdialog.ValueHelpDialog inside the sap.m.table in a multiinput.

Tried a few links and suggestions mentioned on SCN, but couldnt achieve the functionality.

My aim is to set the the value selected from value help in the multiinput, for which I need to bind it with the model of the table and hence I need the index of the table.
Below is the link which I tried :
https://blogs.sap.com/2016/09/05/suggestionsearchvalue-help-in-table-for-multiple-input-fields-in-sa...

In this example, the index is retrieved using the e.getsource().getId() and truncating the index from it, but in my case I am getting dynmic SId and so cannot use the same.
Please suggest.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member227918
Active Contributor
0 Kudos

you can try using binding context as below,

var sBindingContext = oEvent.getSource().getBindingContext();

var sPath = sBindingContext.sPath; //this will return the row binding path for example "/results/1" 1 is row index

// even you can get row data using below code if you need

var rowData = sBindingContext.getObject();

junwu
Active Contributor
0 Kudos

don't use index, you will get bite.

you can use this to update the value.

setProperty(sPath, oValue, oContext?, bAsyncUpdate?)

former_member227918
Active Contributor
0 Kudos

Hello,

I am not sure, what issue you are facing exactly. but you can get row index even if controls are having dynamic id also, check below link if it is help you.

https://jsfiddle.net/Akhilesh_U/q7u7fkpz/

Former Member
0 Kudos

Hi Akhilesh

Thanks for your response.

I am getting the below value when I try to get the ID. This value keeps on changing. Its not always "...clone35", it varies to any value after clone.
e.getSource().getId()
"__component0---detail--multiInput-__clone35"

Thanks

Kanika