Skip to Content
0

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

Apr 04, 2017 at 08:09 AM

58

avatar image
Former Member

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-sapui5/

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.

valuehelp.png (23.0 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Akhilesh Upadhyay Apr 04, 2017 at 12:26 PM
0

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/

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

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

0
Jun Wu Apr 04, 2017 at 04:36 PM
0

don't use index, you will get bite.

you can use this to update the value.

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

Share
10 |10000 characters needed characters left characters exceeded
Akhilesh Upadhyay Apr 05, 2017 at 10:09 AM
0

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();

Share
10 |10000 characters needed characters left characters exceeded