Common Grid control - onclick

I have a grid control filled with data in 4 columns. How do I get the row index of the area of the grid that is clicked?
I may have missed this solution in a sample but I did not find one.

Ryan

Have a look at the Wiki:
https://wiki.appstudio.dev/Grid

Code for doing this in both JavaScript and BASIC is included.

The GridWithScrolling sample also shows how to do this.

I have this grid click event:

    gridCrews.onclick=function(event){
    alert('grid click');
    //need to get position to get index of row in table for id
    var s = Split(event.target.id, "_");
    var row = s[1];
    alert(row);
  
    alert("Click on " + s[0] +  " at row " +  s[1] + " and column " +  s[2]);
    alert("Value is " + gridCrews.getValue(s[1] ,s[2]));
    }

I get the first alert, but I get no other feedback from this code.
Ryan

The correct way to do this is:

gridCrews.onclick=function(event){
//need to get position to get index of row in table for id
var str =  event.target.id;   
var s = str.split("_");
    var row = s[1];
}

I was trying to use the BASIC version of split :slight_smile: