ReInitializeData - cCJGrid
Reloads the initial data into the grid
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| DataSource | Variant[] | Variant array of rows. Most likely this will be of type tDataSourceRow |
| bKeepSelections | Boolean | If false, all selections will be cleared; if true, selections will be kept |
Syntax
Procedure ReInitializeData Variant[] DataSource Boolean bKeepSelections
Call Example
Send ReInitializeData DataSource bKeepSelections
Description
This is similar to InitializeData except it is meant to be used when you wish the reinitialize the data in your grid after you've made a "batch" update, where that update does not affect the grid's current ordering. For example, you might want to clear all checkboxes or change all values in a single column. To do that, you get the data (Get DataSource), make your changes and reinitialize the data by passing the new data array and whether you want to retain the selections from the prior grid. If bKeepSelections is false, all selections will be cleared.
The net result will be that the grid appears updated but all positioning remains as it was. Normally this means your changes should not change the sort order and will not add or delete rows, although this method is flexible and will try to accommodate such changes. It is the developer's responsibility to use this method in an appropriate fashion.
This example assumes that we have a checkbox column named oStat. This will set all of the rows to checked.
Procedure CheckAll
tDataSourceRow[] MyData
Integer iSize i iCol
String sChecked
Get DataSource of (phoDataSource(Self)) to MyData
Move (SizeOfArray(MyData)) to iSize
Get piColumnId of oStat to iCol // column of datasource checkbox
Get psCheckboxTrue of oStat to sChecked // column checked value
For i from 0 to (iSize-1)
Move sChecked to MyData[i].sValue[iCol]
End
Send ReInitializeData MyData True
End_Procedure