Skip to Content
avatar image
Former Member

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

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 04, 2017 at 12:26 PM

    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/

    Add comment
    10|10000 characters needed 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

  • Apr 04, 2017 at 04:36 PM

    don't use index, you will get bite.

    you can use this to update the value.

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

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 05, 2017 at 10:09 AM

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

    Add comment
    10|10000 characters needed characters exceeded