Difference between revisions of "TdxDBGridController"
From Free Pascal wiki
Jump to navigationJump to search (TDBGridController is a non visual component with no dependencies providing added functionalities for the TDBGrid object) |
|||
Line 3: | Line 3: | ||
− | Package download link : https://gitlab.com/lazaruscomponent/ | + | Package download link : https://gitlab.com/lazaruscomponent/dbgridcontroller |
Revision as of 16:01, 30 December 2022
TDBGridController is a non visual component with no dependencies providing added functionalities for the TDBGrid object
Package download link : https://gitlab.com/lazaruscomponent/dbgridcontroller
- You need more functionalities? A grid controller that provide extra features to your existing TDBGrid
- Searching expression in the grid
- Searching expression in column
- Column filter editor
- Datetime editor, memo editor and lookup editor
- Saving the current filter view
- Multi column sorting
- Column chooser editor
- Column grouping visual separator on one level
- Footer and aggregation on columns
- TDBGrid Overidden Events to achive the task
- OnCellDraw
- OnCellHint
- OnEditorEdit
- OnMouseClick
- OnTitleClick
- OnTitleDraw
OnAfterFilterGrid | Event handler signaled after filter execution |
OnAfterSortColumn | Event handler signaled after sorting a column |
OnAggregation | Event handler to define which column is showing an aggregation |
OnBeforeSortColumn | Event handler signaled before sorting a column |
OnLocalize | Event handler signaled to translate string resources |
OnPrepareLookupDataset | Event handler signaled to prepare the lookup dataset if needed |
OnSortColumn | Event handler signaled to change the [order by] statement in a SQL query if needed |
- Aggregation example on 2 lines
Procedure TForm1.dxDBGridController1Aggregation(Sender: TdxDBGridController);
Begin
Sender.ColumnPropertyList.ColumnPropertyByName('ProjectManager').FooterAlignment := taRightJustify;
Sender.ColumnPropertyList.ColumnPropertyByName('ProjectManager').FooterDisplayText :=
'Count Distinct : ' + Sender.ColumnPropertyList.Aggregation(agDistinct, 'ProjectManager').AsString;
// Use the FooterPanel property to set the height : dxDBGridControler1.FooterPanel.Height := Self.DBGrid1.DefaultRowHeight * 2;
Sender.ColumnPropertyList.ColumnPropertyByName('OpeningDate').FooterAlignment := taCenter;
Sender.ColumnPropertyList.ColumnPropertyByName('OpeningDate').FooterDisplayText :=
'Min : ' + Sender.ColumnPropertyList.Aggregation(agMin, 'OpeningDate').AsString + Char(13) + Char(10) +
'Max : ' + Sender.ColumnPropertyList.Aggregation(agMax, 'OpeningDate').AsString;
End;
- Localization example, french translation of some of the component string resources
Procedure TForm1.dxDBGridController1Localize(Sender: TObject; Component: TComponent; ID_Ressource: String; Var Translation: String);
Begin
If ID_Ressource = msg_search Then
Translation := 'Recherche...'
Else If ID_Ressource = msg_first Then
Translation := 'Aller au début'
Else If ID_Ressource = msg_prior Then
Translation := 'Précédent'
Else If ID_Ressource = msg_next Then
Translation := 'Suivant'
Else If ID_Ressource = msg_last Then
Translation := 'Aller à la fin'
Else If ID_Ressource = msg_add Then
Translation := 'Ajouter'
Else If ID_Ressource = msg_delete Then
Translation := 'Détruire'
Else If ID_Ressource = msg_edit Then
Translation := 'Éditer'
Else If ID_Ressource = msg_save Then
Translation := 'Enregistrer'
Else If ID_Ressource = msg_cancel Then
Translation := 'Annuler'
Else If ID_Ressource = msg_refresh Then
Translation := 'Actualiser'
Else If ID_Ressource = msg_btncancel Then
Translation := 'Annuler'
Else If ID_Ressource = msg_of Then
Translation := 'de'
Else If ID_Ressource = msg_nodata Then
Translation := 'Aucune donnée trouvée!';
End;
- Screen shots