Class TrDBStringGridEd

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TrDBStringGridEd = class(TrStringGridEd)

Description

enhanced rStringGridEd component which provides functions for batch loading and saving data from/to dataset

Hierarchy

Overview

Methods

Public procedure CreateTableColumns(SkipFixedCol, SetColWidth: boolean; TitleAlignment: TAlignment = taCenter);
Public procedure LoadTableRows;
Public function SaveTableRows(SaveNewRec: boolean = true; DeleteEmptyRec: boolean = true): Longint;
Public procedure LoadTableData(Dataset: TDataset; KeyField: Tfield; ColumnGroup: integer = 0; ClearCurrentData: boolean = true; LoadAsNewValues: boolean = false);
Public function SaveTableData(Dataset: TDataset; KeyField: Tfield; ColumnGroup: integer = 0; DeleteEmptyRec: boolean = true): integer;
Public procedure LoadPivotColumn(Dataset: TDataset; ColumnKeyField, ColumnDisplayField: Tfield; FromColumnIdx: Longint; ColumnGroup: integer = 0);
Public procedure LoadPivotData(Dataset: TDataset; RowKeyField, ColumnKeyField, ValueField: Tfield; ColumnGroup: integer = 0; ClearCurrentData: boolean = true; LoadAsNewValues: boolean = false);
Public function SavePivotData(Dataset: TDataset; RowKeyField, ColumnKeyField, ValueField: Tfield; ColumnGroup: integer = 0; DeleteEmptyRec: boolean = true) : Longint;
Public function IndexOfRowKeyValue(KeyValue: integer): Longint;
Public function IndexOfColKeyValue(KeyValue: integer): Longint;

Properties

Public property RecsUpdatedCount: Longint read FRecsUpdatedCount;
Public property CellsUpdatedCount: Longint read FCellsUpdatedCount;
Public property WarningList: TStrings read FWarningList;
Public property RowKeyValue[ARow:Longint]: integer read GetRowKeyValue write SetRowKeyValue;
Public property ColKeyValue[ACol:Longint]: integer read GetColKeyValue write SetColKeyValue;
Published property OptionsDBEx: TOptionsDBEx read FOptionsDBEx write FOptionsDBEx default[dgSetAutoIncGrayed, dgSaveKeyFieldValue];
Published property DataSource: TDataSource read GetDataSource write SetDataSource;
Published property KeyFieldName: string read FKeyFieldName write FKeyFieldName;
Published property CreateTableColNow: boolean read FCreateTableCol write SetCreateTableCol default false;
Published property DBLoadCellFromField: TDBLoadStoreCellField read FDBLoadCellFromField write FDBLoadCellFromField;
Published property DBStoreCellToField: TDBLoadStoreCellField read FDBStoreCellToField write FDBStoreCellToField;
Published property DBBeforePostEvent: TDBBeforePostEvent read FDBBeforePost write FDBBeforePost;
Published property OnDBUpdateError: TUpdateErrorEvent read FDBUpdateError write FDBUpdateError;

Description

Methods

Public procedure CreateTableColumns(SkipFixedCol, SetColWidth: boolean; TitleAlignment: TAlignment = taCenter);

define grid columns properties from Field list of linked datasource, only visible and non graphics fields are used

Public procedure LoadTableRows;

reset grid and load all rows from linked datasource to grid, KeyField value is used to keep ID for each record

Public function SaveTableRows(SaveNewRec: boolean = true; DeleteEmptyRec: boolean = true): Longint;

post all changes to linked dataset, KeyField value is used to locate modified record

Public procedure LoadTableData(Dataset: TDataset; KeyField: Tfield; ColumnGroup: integer = 0; ClearCurrentData: boolean = true; LoadAsNewValues: boolean = false);

use defined columns+rows and load data from Dataset to grid, KeyField value is used to locate row for each record, Column FieldName is used to locate column for each field

Public function SaveTableData(Dataset: TDataset; KeyField: Tfield; ColumnGroup: integer = 0; DeleteEmptyRec: boolean = true): integer;

post all changes to Dataset, KeyField value is used to locate row for each record, Column FieldName is used to locate column for each field

Public procedure LoadPivotColumn(Dataset: TDataset; ColumnKeyField, ColumnDisplayField: Tfield; FromColumnIdx: Longint; ColumnGroup: integer = 0);

define grid columns properties from records of Dataset, for each record one Column is created, ColumnKeyField value is used to keep ID for each column record

Public procedure LoadPivotData(Dataset: TDataset; RowKeyField, ColumnKeyField, ValueField: Tfield; ColumnGroup: integer = 0; ClearCurrentData: boolean = true; LoadAsNewValues: boolean = false);

load data from Dataset to defined Pivot table, RowKeyField value is used to locate row for each record, ColumnKeyField value is used to locate column for each record, ValueField value is stored to cell

Public function SavePivotData(Dataset: TDataset; RowKeyField, ColumnKeyField, ValueField: Tfield; ColumnGroup: integer = 0; DeleteEmptyRec: boolean = true) : Longint;

post all changes to Dataset, RowKeyField and ColumnKeyField value is used to locate/create of record for each changed cell, ValueField is updated from cell

Public function IndexOfRowKeyValue(KeyValue: integer): Longint;

return index of row with defined key value

Public function IndexOfColKeyValue(KeyValue: integer): Longint;

return index of column with defined key value

Properties

Public property RecsUpdatedCount: Longint read FRecsUpdatedCount;

define number of modified rows

Public property CellsUpdatedCount: Longint read FCellsUpdatedCount;

define number of modified cells

Public property WarningList: TStrings read FWarningList;

define list of warnings during loading data

Public property RowKeyValue[ARow:Longint]: integer read GetRowKeyValue write SetRowKeyValue;

get or set Key Value for defined Row

Public property ColKeyValue[ACol:Longint]: integer read GetColKeyValue write SetColKeyValue;

get or set Key Value for defined Column

Published property OptionsDBEx: TOptionsDBEx read FOptionsDBEx write FOptionsDBEx default[dgSetAutoIncGrayed, dgSaveKeyFieldValue];

list of new options

Published property DataSource: TDataSource read GetDataSource write SetDataSource;

link to connected dataset

Published property KeyFieldName: string read FKeyFieldName write FKeyFieldName;

define name of KeyField which contain ID of each record (should be integer value)

Published property CreateTableColNow: boolean read FCreateTableCol write SetCreateTableCol default false;

used in design time to load column definition from linked datasource

Published property DBLoadCellFromField: TDBLoadStoreCellField read FDBLoadCellFromField write FDBLoadCellFromField;

event used for user defined loading data from field to cell

Published property DBStoreCellToField: TDBLoadStoreCellField read FDBStoreCellToField write FDBStoreCellToField;

event used for user defined storing data from cell to field

Published property DBBeforePostEvent: TDBBeforePostEvent read FDBBeforePost write FDBBeforePost;

event used for modification of dataset before post changes

Published property OnDBUpdateError: TUpdateErrorEvent read FDBUpdateError write FDBUpdateError;

event for error handling


Generated by PasDoc 0.13.0 on 2018-03-18 20:50:39