Class TrDBStringGridEd

Unit

Declaration

type TrDBStringGridEd = class(TrStringGridEd)

Description

enhanced TrStringGridEd component which provides functions for batch loading and saving data from/to dataset. It helps to use simple table, multitable or pivot table data showing and editing

Hierarchy

Overview

Methods

Public function GetEditStyleEx(ACol, ARow: Longint): TrStringGridEdEditStyle; override;
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 procedure LoadTableMultiRows;
Public function SaveTableMultiRows(SaveNewRec: boolean = true): Longint;
Public procedure AddNewRecMultiRows(InsertToTop: boolean = false; InsertInCurrentPos: boolean = false);
Public function IsTableMultiRows: boolean;
Public procedure RefreshMultiRowHeights;
Public function GetMultiRowDef(ARow: Longint): TrDBStringGridEdMultiRow;
Public function GetCellMultiRowDef(ACol, ARow: Longint): TrDBStringGridEdMultiRow;
Public function GetCellMultiRowType(ACol, ARow: Longint): TMultiRowType;
Public function GetMultiRowFixedCol: integer;
Public function GetMultiRowDataCol: integer;
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 MultiRowsOptions: TMultiRowsOptions read FMultiRowsOptions write FMultiRowsOptions;
Published property MultiRowsDef: TrDBStringGridEdMultiRows read FMultiRowsDef write FMultiRowsDef;
Published property MultiRowsPreview: boolean read FMultiRowsPreview write SetMultiRowsPreview default false;
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 DBUpdateCellContent: TDBUpdateCellContent read FDBUpdateCellContent write FDBUpdateCellContent;
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 function GetEditStyleEx(ACol, ARow: Longint): TrStringGridEdEditStyle; override;

return edit style of data in cell

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 procedure LoadTableMultiRows;

load multirows for each record from linked datasource to grid, KeyField value is used to keep ID for each multirow group

Public function SaveTableMultiRows(SaveNewRec: boolean = true): Longint;

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

Public procedure AddNewRecMultiRows(InsertToTop: boolean = false; InsertInCurrentPos: boolean = false);

add or insert new empty rows for a new multirow record

Public function IsTableMultiRows: boolean;

define whether LoadTableMultiRows was used to load data

Public procedure RefreshMultiRowHeights;

set row heights for all multirows

Public function GetMultiRowDef(ARow: Longint): TrDBStringGridEdMultiRow;

returns multirow definition for the specific row

Public function GetCellMultiRowDef(ACol, ARow: Longint): TrDBStringGridEdMultiRow;

returns multirow definition for the specific cell

Public function GetCellMultiRowType(ACol, ARow: Longint): TMultiRowType;

returns multirow content type for the cell

Public function GetMultiRowFixedCol: integer;

returns column index of the column used as multirow fixed col

Public function GetMultiRowDataCol: integer;

returns column index of the column used as multirow data col

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 MultiRowsOptions: TMultiRowsOptions read FMultiRowsOptions write FMultiRowsOptions;

multirow options

Published property MultiRowsDef: TrDBStringGridEdMultiRows read FMultiRowsDef write FMultiRowsDef;

multirow collection, for detail see TrDBStringGridEdMultiRows

Published property MultiRowsPreview: boolean read FMultiRowsPreview write SetMultiRowsPreview default false;

defines preview of multirow definition in the design time

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 DBUpdateCellContent: TDBUpdateCellContent read FDBUpdateCellContent write FDBUpdateCellContent;

event type used by TrDBStringGridEd to load and store field value for multirow cell

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.15.0.