SelectedRow - cCJGridDataSource
Returns the row number of the SelectedRow
Type: Function
Return Data Type: Integer
Syntax
Function SelectedRow Returns Integer
Call Example
Get SelectedRow to IntegerVariable
Description
SelectedRow determines which row in the datasource is currently selected. This is the row that is the current focus row of the grid. It is crucial that the SelectedRow in the datasource object match the grid's focus row. The SelectedRow is also used to synchronize activity between a DataDictionary object and the datasource.
The cCJGrid class carefully maintains SelectedRow, which ensures that the grid, the datasource, and external data (e.g., DataDictionary objects and file buffers) are all synchronized. If you need to know which row is the focus row, you must query SelectedRow. It is possible for no row to be selected, in which case, SelectedRow is -1.
// Find the RowId of the SelectedRow
RowId riId
Integer iSel
Handle hoDataSource
Get phoDataSource to hoDataSource
Get SelectedRow of hoDataSource to iSel
If (iSel<>-1) Begin
Get RowTag of hoDataSource iSel to riId
End
A selected column is also maintained. The datasource object does not care which column is selected and therefore SelectedColumn is maintained by the cCJGrid class.
See Also
Return Value
The row index of the SelectedRow. If no row is selected, returns -1.