vcl-cxgridtableview-7cfc580f.md
The base class for columns in Table and Banded Table grid Views.
TcxCustomGridColumn = class(
TcxCustomGridTableItem
)
The TcxCustomGridColumn class implements core functionality common to all Table and Banded Table grid Views in all supported data access modes. A column displays data of the same type in a table. In bound and server data access modes, a column corresponds to an individual dataset field.
A column can use any unbound editor shipped with the ExpressEditors Library as an in-place editor for cell edit operations. An in-place editor instance exists (and, therefore, consumes memory and other system resources, such as a WinAPI handle) only when a column cell is being edited. Otherwise, the column displays a static editor image for resource usage optimization.
To switch between available editors, you can use the PropertiesClassName or PropertiesClass property. Use the Properties property to configure the in-place editor associated with the column.
The list below outlines key members of the TcxCustomGridColumn class. These members allow you to configure columns in Table and Banded Table grid Views.
ApplyBestFit | BestFitMaxWidthAllow you to adjust the column width to display content in full and limit the maximum column width in this mode.Caption | AlternateCaptionSpecify main and alternative captions for the column. An alternative column caption can replace the main caption in customization dialogs, filter panels, etc.HeaderGlyph | HeaderImageIndexAllow you to assign a glyph to the column header.OnCustomDrawCellAllows you to override or complement column draw routines.OnGetDisplayText | OnGetFilterDisplayTextAllow you to customize display text and column captions displayed in a filter drop-down window.OnGetFilterImages | OnGetFilterValuesAllow you to customize the column’s filter drop-down window.StylesAllows you to customize the appearance of different column elements.
FooterAlignmentHorzAllows you to position column footer cells.HeaderAlignmentHorz | HeaderAlignmentVertPosition the column header horizontally and vertically.HeaderGlyphAlignmentHorz | HeaderGlyphAlignmentVertSpecify the glyph position within the column header.LayoutItem | RowLayoutItemAllow you to configure the column in a custom row layout.MinWidthSpecifies the minimum column width, in pixels.
AIProvides access to AI-powered functionality settings.EditingSpecifies if the assigned in-place cell editor is active.OnGetPropertiesAllows you to display different in-place editors for different records or customize editor settings based on custom conditions.OnGetPropertiesForEditAllows you to change the assigned in-place editor and customize its settings when a user invokes the editor.PropertiesProvides access to the settings of the assigned in-place editor.PropertiesClassSpecifies the active in-place editor class. At design time, you can use the Properties node in the Object Inspector to assign an in-place editor to the column and configure the editor.RepositoryItem
Allows you to associate the column with a repository item that defines the required in-place editor and its settings.
Tip
Repository items are particularly useful if you need to share in-place editor settings between multiple grid View items or customize editor settings in OnGetProperties and OnGetPropertiesForEdit event handlers.
DataBindingProvides access to data binding settings.GroupIndexAllows you to group columns in the parent grid View by the current column.SortIndex | SortOrderAllow you to sort data in the parent grid View against the current column.
IsBottom | IsLeft | IsMostBottom | IsMostLeft | IsMostRight | IsRight | IsTopAllow you to identify the column’s position within the parent grid View.FixedKindAllows you to fix the column or dock it to the left when users scroll the parent grid View to the right.FocusedSpecifies if the column has focus.IndexDefines the column position in its parent grid View.IsFirst | IsLastIdentify if the column is the first or last in the parent grid View’s collection of visible columns.IsPreviewAllows you to identify if the column has a preview section.MakeVisibleScrolls the parent grid View to display the current column.SelectedIdentifies if the column is selected.SummaryProvides access to column summary settings.VisibleForEditForm | VisibleForRowLayoutSpecify if the column is visible in an in-place Edit Form and the custom row layout.
EditableAllows you to identify if the column is editable.GridViewProvides access to the parent grid View.OptionsAllows you to configure general column settings.RestoreDefaultsRestores the default values of column type-specific settings, such as Caption and Width.ShowExpressionEditorInvokes the Expression Editor dialog.[1]VisibleSpecifies if the column is visible.
The following code example creates an unbound Table View column, assigns an in-place spin editor to it, and limits the editor’s input value range:
uses cxSpinEdit;
// ...
var
AColumn: TcxGridColumn;
ASpinEditProperties: TcxSpinEditProperties;
begin
AColumn := cxGrid1TableView1.CreateColumn; // Creates a new unbound column
AColumn.DataBinding.ValueType := 'Currency'; // Changes the column value type to "Currency"
AColumn.PropertiesClass := TcxSpinEditProperties; // Assigns an in-place spin editor
ASpinEditProperties := AColumn.Properties as TcxSpinEditProperties;
ASpinEditProperties.MinValue := 0; // Sets the minimum edit value
ASpinEditProperties.MaxValue := 1000; // Sets the maximum edit value
ASpinEditProperties.Circular := True; // Loops value changes within the defined range
end;
#include "cxSpinEdit.hpp"
// ...
TcxGridColumn *AColumn;
TcxSpinEditProperties *ASpinEditProperties;
// ...
AColumn = cxGrid1TableView1->CreateColumn(); // Creates a new unbound column
AColumn->DataBinding->ValueType = "Currency"; // Changes the column value type to "Currency"
AColumn->PropertiesClass = __classid(TcxSpinEditProperties); // Assigns an in-place spin editor
ASpinEditProperties = dynamic_cast<TcxSpinEditProperties*>(AColumn->Properties);
ASpinEditProperties->MinValue = 0; // Sets the minimum edit value
ASpinEditProperties->MaxValue = 1000; // Sets the maximum edit value
ASpinEditProperties->Circular = true; // Loops value changes within the defined range
To delete a grid column, release it directly in code (call the Free procedure in Delphi or use the delete keyword in C++Builder):
cxGrid1TableView1Column1.Free;
delete cxGrid1TableView1Column1;
Do not use the TcxCustomGridColumn class directly. Use the following descendants instead:
TcxGridColumnA column in an unbound grid Table View.TcxGridBandedColumnA column in an unbound Banded Table View.
TcxGridDBColumnA column in a data-aware grid Table View.TcxGridDBBandedColumnA column in a data-aware Banded Table grid View.
TcxGridServerModeColumnA column in a Server Mode grid Table View.TcxGridServerModeBandedColumnA column of a Banded Table View in Server Mode.
TObject TPersistent TComponent TcxCustomComponent TcxComponent TcxCustomGridTableItem TcxCustomGridColumn
Footnotes
See Also
TcxGridDBBandedTableView Class
TcxGridServerModeTableView Class