Table of Contents

TTMSFNCCustomDataGridDatabaseAdapter Class

Base class for the TMS FNC DataGrid database adapter. Binds a TDataSource to the grid, maps dataset fields to columns, and handles reading, writing, sorting, grouping, and filtering of dataset records through the grid UI.

API unit family: TMSFNCDataGridDatabaseAdapter Inherits from: TTMSFNCDataGridRendererDataAdapter

Syntax

TTMSFNCCustomDataGridDatabaseAdapter = class(TTMSFNCDataGridRendererDataAdapter)

Properties

Name Description
ColumnAtField Returns the adapter column item whose FieldName matches AFieldName, or nil when not found.
DataLink The internal TDataLink that connects this adapter to the TDataSource. Provides low-level access to the dataset link state.
FieldAtColumn Returns the TField instance mapped to grid column AColumn, or nil when no field is mapped to that column.
FieldIndexAtColumn Returns the dataset field-list index of the field mapped to grid column AColumn, or -1 when no field is mapped.
FieldNames Gets or sets the field name mapped to adapter column AIndex. Setting this property updates the corresponding Columns[AIndex].FieldName value.

Methods

Name Description
AddAllFields Adds columns to the Columns collection for every field in the active dataset that is not already mapped. Equivalent to calling CreateColumns after clearing existing mappings.
BeginUpdate Temporarily suspends adapter refreshes while multiple dataset or grid changes are applied.
BlobFieldToPicture Decodes the binary content of AField (a BLOB field containing an image) and loads it into ABitmap.
CheckDataSet Returns True when the adapter has an active, open dataset available for reading. Call before performing dataset operations to avoid exceptions.
ConvertDataToField Writes the grid cell value for ACell back to AField in the dataset, applying the OnDataToField event. Call after in-place editing to post a single field without posting the entire record.
ConvertFieldToData Reads the current value of AField from the dataset and converts it into ACellValue, firing OnFieldToData for custom overrides.
CreateColumns Rebuilds the grid's column list from the current Columns collection (or from all dataset fields when Columns is empty and AutoCreateColumns is True).
DataSetCanModify Returns True when the bound dataset allows record modification (CanModify is True and the dataset is active).
DataSetCancel Cancels any pending edit or insert operation, equivalent to calling DataSource.DataSet.Cancel.
DataSetDelete Deletes the current dataset record, equivalent to calling DataSource.DataSet.Delete.
DataSetDisableControls Suppresses dataset change notifications to all linked controls. Call around bulk data operations to avoid redundant grid refreshes; always pair with DataSetEnableControls.
DataSetEdit Puts the bound dataset into edit mode for the current record, equivalent to calling DataSource.DataSet.Edit. Raises an exception if the dataset is unidirectional or read-only.
DataSetEnableControls Re-enables dataset change notifications to all linked controls after a DataSetDisableControls call.
DataSetInsert Appends a new record to the dataset and puts it into insert mode, equivalent to calling DataSource.DataSet.Insert.
DataSetIsEditing Returns True when the dataset is currently in edit mode (dsEdit state).
DataSetIsInserting Returns True when the dataset is currently in insert mode (dsInsert state).
DataSetLocate Locates a record in the dataset by matching AKeyValues against AKeyFieldNames (comma-separated). Returns True when the record is found and the dataset is repositioned to it.
DataSetPost Posts the current edit or insert operation to the dataset, equivalent to calling DataSource.DataSet.Post.
DeleteRow Deletes the dataset record represented by grid row ARow.
EditCell Starts in-place editing for the dataset field represented by ACell.
EditSetData Stores the value from an in-place editor into the pending dataset field value for ACell.
EndUpdate Resumes adapter refreshes after BeginUpdate and refreshes the grid when needed.
GetActiveRow Returns the zero-based grid row index that corresponds to the dataset's current record. Returns -1 when no record is active.
GetGridColumnIndex Maps an adapter column index to the corresponding grid column index. Returns -1 when no mapping exists.
InsertRow Inserts a new dataset record before the record represented by grid row ARow.
IsValidDataCell Returns True when ACell falls within the data area of the grid (i.e. not a fixed row or column and within the current dataset bounds).
IsValidDataRow Returns True when ARow is a data row (not a fixed row and within the current dataset record count).
LoadAllData Loads all dataset records into an in-memory buffer regardless of the current LoadMode. Useful before performing bulk export or client-side sort/group operations on datasets that do not support random access.
LoadValuesFromField Fills AValues with the distinct string values of AField by iterating all records. Used to populate filter drop-down lists.
ReloadFromDataSet Forces the adapter to re-read the current dataset state and repopulate the grid from scratch. Call after programmatically changing dataset data outside the adapter.
RemoveAllColumns Removes all items from the Columns collection and deletes the corresponding grid columns.
RemoveAllFields Clears all field name bindings in the Columns collection without removing the columns from the grid.
ResetActiveRecord Navigates the dataset back to the record that was active before the last SetActiveRecord call.
SelectCell Selects the grid cell and synchronizes the dataset position with the selected data row.
SetActiveRecord Navigates the dataset to the record corresponding to grid row ARow. Returns True on success. Does not trigger grid selection events.
Update Recalculates the grid layout and refreshes visible cells. Call after programmatically changing column or row structure without triggering a full data reload.