TTMSFNCDataGridDatabaseAdapter Class
Non-visual component that shows the records of a
TDataSourcein a data grid and writes grid edits back to the dataset.
API unit family: TMSFNCDataGridDatabaseAdapter
Inherits from: TTMSFNCCustomDataGridDatabaseAdapter
Syntax
TTMSFNCDataGridDatabaseAdapter = class(TTMSFNCCustomDataGridDatabaseAdapter)
class PASCALIMPLEMENTATION TTMSFNCDataGridDatabaseAdapter : public TTMSFNCCustomDataGridDatabaseAdapter
Remarks
Assign the adapter to the grid's TTMSFNCCustomDataGrid.Adapter property and set TTMSFNCCustomDataGridDatabaseAdapter.DataSource; opening the dataset fills the grid. At design time, a newly dropped adapter assigns itself to the first grid on the form that has no adapter yet.
Columns are created from the dataset fields or defined in TTMSFNCCustomDataGridDatabaseAdapter.Columns. TTMSFNCCustomDataGridDatabaseAdapter.LoadMode chooses between buffered loading for large datasets and loading all records for in-grid sorting, filtering, and grouping, and TTMSFNCCustomDataGridDatabaseAdapter.DetailControl adds expandable master-detail rows. The same component works in desktop and web applications.
Properties
| Name | Description |
|---|---|
| AutoCreateColumns | When True (default), the adapter adds a column mapping for every dataset field that has none when the dataset is opened. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| AutoRemoveColumns | When True (default), the column mappings and grid columns are removed when the dataset closes or the data source is disconnected. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ColumnAtField | Returns the column mapping bound to a field name. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| Columns | The field-to-column mappings that decide which fields the grid shows, in which order, and how. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataLink | The data link that connects the adapter to DataSource. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSource | The data source whose dataset is shown in the grid. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DetailControl | Control shown below a row when the user expands it, typically a second grid bound to a detail dataset. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DynamicRecordCount | When True, the grid's row count follows the records the dataset has fetched so far instead of assuming RecordCount is final. Default is False. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| FieldAtColumn | Returns the dataset field bound to an adapter column. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| FieldIndexAtColumn | Returns the index in the dataset's Fields list of the field bound to an adapter column. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| FieldNames | Gets or sets the field name of the item at a given index in Columns. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| HeaderRow | The grid row that receives the column headers. Default is 0. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| KeepData | When True, the grid keeps the loaded cell data when the dataset is closed or disconnected. Default is False. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| LoadMode | Controls how many records are buffered and who sorts, filters, and groups. Default is almBuffered. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ShowBooleanFields | When True (default), ftBoolean fields are shown as check boxes. Set to False to show them as text. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ShowDateTimeFields | When True (default), date, time, date-time, and timestamp fields are formatted as dates and times by the grid. Set to False to leave their formatting to the grid column. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ShowMemoFields | When True, the text of memo fields is shown. Default is False, which shows the placeholder (MEMO) instead. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ShowPictureFields | When True (default), ftGraphic fields are shown as images in the cell. Set to False to show them as text. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| Version | Component version string in Major.Minor.Release.Build format. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
Methods
| Name | Description |
|---|---|
| AddAllFields | Binds the Columns collection to all fields of the linked dataset, in field-list order. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| BeginUpdate | Suspends the adapter's reactions to dataset and grid changes while several changes are made. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| BlobFieldToPicture | Decodes the image stored in a blob field and loads it into a bitmap. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| CheckDataSet | Checks whether the adapter can currently exchange data with its dataset. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ConvertDataToField | Writes a cell value to a dataset field, applying OnDataToField and the default conversion. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ConvertFieldToData | Converts the current value of a dataset field into a cell value, applying OnFieldToData and the default conversion. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| CreateColumns | Clears Columns and recreates one auto-created mapping per visible field of the open dataset, then refreshes the grid. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetCanModify | Checks whether the linked dataset allows changes. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetCancel | Cancels pending changes of the linked dataset by calling TDataSet.Cancel. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetDelete | Deletes the current record of the linked dataset by calling TDataSet.Delete. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetDisableControls | Calls TDataSet.DisableControls on the linked dataset so that all linked controls, including this grid, stop following changes. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetEdit | Puts the linked dataset into edit mode unless it is already editing. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetEnableControls | Calls TDataSet.EnableControls on the linked dataset, ending a DataSetDisableControls call. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetInsert | Inserts a new record at the current position of the linked dataset by calling TDataSet.Insert. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetIsEditing | Checks whether the linked dataset is in edit mode. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetIsInserting | Checks whether the linked dataset is in insert mode. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetLocate | Moves the linked dataset to the first record that matches the given key values. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DataSetPost | Posts the record being edited in the linked dataset. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| DeleteRow | Deletes the dataset record shown in a grid row. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| EditCell | Prepares the dataset for editing the field shown in a grid cell. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| EditSetData | Writes the value from an in-place editor to the field shown in a grid cell. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| EndUpdate | Ends an update started with BeginUpdate. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| GetActiveRow | Returns the grid row that shows the dataset's current record. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| GetGridColumnIndex | Converts an adapter column index into a grid column index. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| InsertRow | Starts a new dataset record at the position of a grid row. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| IsValidDataCell | Checks whether a grid cell holds dataset data. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| IsValidDataRow | Checks whether a grid row represents a dataset record. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| LoadAllData | Reads every cell of every record once, so all values are cached in the grid's own data. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| LoadValuesFromField | Fills a list with the value of a field for every record of its dataset. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ReloadFromDataSet | Reloads the grid from the linked dataset. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| RemoveAllColumns | Removes all column mappings and clears the grid, setting its row and column counts to 0. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| RemoveAllFields | Clears the field binding of every item in Columns while keeping the items and grid columns. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| ResetActiveRecord | Restores the data link's active record saved by the last SetActiveRecord call. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| SelectCell | Moves the dataset to the record of a selected grid cell. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| SetActiveRecord | Makes the buffered record of a grid row the data link's active record, so field values can be read for that row. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| Update | Resynchronizes the grid with the dataset position and repaints the data. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
Events
| Name | Description |
|---|---|
| OnAfterApplyFilter | Fires after the adapter has assigned a filter expression to the dataset and switched Filtered on. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnBeforeApplyFilter | Fires before the adapter assigns a filter expression, built from the grid's filter, to the dataset. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnDataToField | Fires when an edited cell value is about to be written to its dataset field. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnFieldToData | Fires when a field value is read from the dataset to fill a grid cell. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnFilterData | Fires when the grid's filter must be applied to the dataset, and replaces the adapter's built-in filtering when assigned. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnGetFilterValues | Fires when a column's filter drop-down requests its list of values, and replaces the default list when assigned. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnGetHTMLTemplate | Fires for each cell of a templated column before its template is evaluated, so the template can differ per record. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnGetHTMLTemplateData | Fires for each <#FieldName> placeholder in a cell template, after the adapter resolved its value. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnGetRecordCount | Fires each time the adapter determines the number of records, allowing the value to be corrected. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |
| OnSortData | Fires when the grid's sort order must be applied to the dataset, and replaces the adapter's built-in sorting when assigned. (inherited from TTMSFNCCustomDataGridDatabaseAdapter) |