Skip to content

RefreshDataFromMatchingRow - cDbCJGrid

Refreshes and redisplays a dynamic grid based around the passed RowId and offset from top

Type: Procedure

Parameters

Parameter Type Description
riID RowID The Record RowId to display the grid around
iOffset Integer Offset from top of grid to display the matching row

Syntax

Procedure RefreshDataFromMatchingRow RowID riID Integer iOffset

Call Example

Send RefreshDataFromMatchingRow riID iOffset

Description

RefreshDataFromMatchingRow is used to refresh the grid's datasource with new data based around records found above and below the matching row record. This can only used with grids that use dynamic datasources such as the cDbCJGrid, which uses a cDbCJGridDataSource. RefreshDataFromMatchingRow clears the current datasource and refreshes it by finding the record identified by riID and then filling in records around it.

iOffset is used to determine in what row the target riID record should appear relative to the top of the grid. The offset must be 0 (top) or a positive number that is less than the number of rows in the datasource. Special values ropTop (same as 0), ropBottom and ropCenter can also be used. ropBottom and ropCenter can only be used if the grid uses fixed row width, which means that all columns must have their pbMultiLine set to false. The actual offset from the top may be adjusted to make the SelectedRow visible.

Upon completion, SelectedRow will be set to the riID row. SelectedColumn will be unchanged.

This message will be used when you wish to jump to a location in your grid based on a known row Id. It can also be used to jump into a newly activated grid at a known location.

// reload the grid based on the passed customer name
Procedure CustomRefreshMyList string sName
    RowId riID

    Clear Customer
    Move sName to Customer.Name
    Find GE Customer by 2 // index 2 is customer name
    Move (GetRowId(Customer.File_Number)) to riID
    Send  RefreshDataFromMatchingRow riID  2 
    Send MoveToFirstEnterableColumn
End_Procedure

This should only be used with dynamic grids. It cannot be used with cCJGrids and it should only be used with cDbCJGrids if the grid is non-static (the pbStaticData property is false). The message is supported at the cCJGrid level so that developers could create their own dynamic sub-classes using their own custom dynamic datasources.

RefreshDataFromSelectedRow can be used to refresh existing data in a grid based around the RowId in the SelectedRow.

It is the developer's responsibility to make sure that the target record for this refresh is a valid record. It must exist and it must be constraint valid. If the record is not valid, the refresh will not succeed and the HandleCacheError method will be called. When HandleCacheError is called, it will handle this condition by refreshing the grid and, if pbSuppressCacheError is False, reporting an error.