getCellValue( row, col )
This method returns the value or contents of a grid cell. Â The cell must be visible when this method is called.
Using "load fields into widgets" property
When using a database-driven grid with the "load fields into widgets" property enabled, getDataValue() will need to be used instead, as the data is no longer loaded directly onto the grid.
Parameters:
row - the row number to retrieve the value from; when using events such as onrowclick, onrowdblclick, onrowmouseover, and onrowmouseout, the row variable is automatically passed into the event and can be used as the parameter to this method; row numbers start with row 1
col - the column number to retrieve the value from; the column numbers are zero-based (i.e. the first column* is column 0, the second column is column 1, etc.)
*Column 0 refers to the first column as established during design-time (in Visual Designer). If movable columns is true, then the user could change the column order; getCellValue(row, 0) retrieves the value in the first column, even if the user has moved that column.
Example:
The following expression can be assigned to the onrowclick event of a grid with an id of "subfile" to start a Google search using the value in the first column of the row being clicked:
window.open("http://www.google.com/search?q=" + encodeURIComponent(getObj("subfile").grid.getCellValue(row, 0));
Alternatively, an expression such as "handleRowClick(row)" can be assigned to the event, and the following function can be placed into an external JavaScript file:
function handleRowClick(row) {
var value = getObj("subfile").grid.getCellValue(row, 0);
window.open("http://www.google.com/search?q=" + encodeURIComponent(value));
}