cancel
Showing results for 
Search instead for 
Did you mean: 

Get index of row when valueHelpRequest fired on sap.ui.table.Table ValueHelpField column

onur_sara
Participant
0 Kudos

Hi All,

I have a problem about getting index of row when I click valueHelp button on a column which template is ValueHelpField .

Actually I wrote a code at event function to get index of table .

  1. var oTable = sap.ui.getCore().byId("oMagazaTable"); 
  2.   var row = e.getSource().getParent(); 
  3.   var tableindex = oTable.indexOfRow(row); 

This code works perfect during table doesn't have rows which counts are not  more than visiblerowcount .

If Table has more rows  this code does not take the scroll bar position  , and makes the first visiblerow's index as 0 .

So because of this giving me wrong index number  .

I need to to add scroll bar position into index data ,

So How can I get  scroll bar index position?

or If you know any other way to get index for my case  please  let me know .

Greetings,

Onur

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

try,

var path = oEvent.getSource().getBindingContext("oTableModel").getPath();

  var row= path.substring(path.lastIndexOf('/') +1);

onur_sara
Participant
0 Kudos

Hi Santhosh ,

I modified your code like this and worked very well.


var path = e.getSource().getBindingContext().sPath;

  var tableindex= path.substring(path.lastIndexOf('/') +1);

Thanks a lot

santhu_gowdaz
Active Contributor
0 Kudos

"oTableModel" is the reference of the table model. If you are binding the model to table with out reference then no need to mention in the getBindingContext() method.

Answers (0)