RowTag - cCJGridDataSource
Returns the RowID for the passed row number
Type: Function
Return Data Type: RowID
Parameters
| Parameter | Type | Description |
|---|---|---|
| iRow | Integer | The row number index |
Syntax
Function RowTag Integer iRow Returns RowID
Call Example
Get RowTag iRow to RowIDVariable
Description
RowTag returns the RowId of the passed iRow number. The returns the riID member of the tDataSourceRow array for the passed iRow.
// 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
cCJGrid / cCJGridDataSource
RowIds are not automatically maintained when you create a cCJGrid (cCJGridDataSource) object, but you can add this information to your datasource as needed when the data is loaded. If you don't add RowIds, which is allowed and typical, the returned RowId will be null.
Sample
This examples loads data into a 2 column cCJGrid. In addition to the two columns, the RowId is also stored for each row.
Procedure LoadData
Handle hoDataSource
tDataSourceRow[] TheData
Boolean bFound
Integer iRows
Integer iNum iName
Get phoDataSource to hoDataSource
// Get the datasource indexes of the various columns
Get piColumnId of oCustomer_Customer_Number to iNum
Get piColumnId of oCustomer_Name to iName
// Load all data into the datasource array
Clear Customer
Find ge Customer by 1
Move (Found) to bFound
While bFound
Move (GetRowId(Customer.File_Number)) to TheData[iRows].riID
Move Customer.Customer_Number to TheData[iRows].sValue[iNum]
Move Customer.Name to TheData[iRows].sValue[iName]
Increment iRows
Find gt Customer by 1
Move (Found) to bFound
Loop
// Initialize Grid with new data
Send InitializeData TheData
Send MovetoFirstRow
End_Procedure
cDbCJGrid / cDbCJGridDataSource
The RowId must be set in the datasource array. If the data is dynamically managed by the datasource, this occurs automatically. If you create a static data source similar to the above sample, you must provide RowIds.
Return Value
The RowId for the row.