onrowclick event (Grid)



The onrowclick event activates when a row within a grid is clicked. The following special variables are available to the event handler: 

  • rrn gives the grid record number that was clicked. The record numbers are in the order written by the RPG program. This variable can be used by the click event handler to generate subfile widget ids, which are automatically suffixed with the record number. 

  • rowNumber gives the grid row number that was clicked. This can be different than the 'rrn' value, if client-side sorting is used with the grid. This value can be used with the grid's "getDataValue" and "getCellValue" APIs. 

  • isRightClick is a Boolean (true/false) value that indicates whether or not this event fired for a right mouse click. The 'onrowclick' event will  fire on a right mouse click when the grid has an associated context menu. This happens before the context menu is shown. 

  • row (deprecated) gives the same value as 'rrn' for RPG-based subfile grids, and the same value as 'rowNumber' for database-driven grids.

Example:

The following example starts a Google search using the value in the first column of the row being clicked:

onrowclick: handleRowClick(row, isRightClick);

function handleRowClick(row, isRightClick) { // Do not open when user has right clicked for context menu. if (!isRightClick) { var value = getObj("subfile").grid.getCellValue(row, 0); window.open("http://www.google.com/search?q=" + encodeURIComponent(value)); } }