TcxGrid Class
A Data Grid control.
Declaration
TcxGrid = class(
TcxCustomGrid
)
Remarks
The Data Grid allows you to display data as a table and in a variety of other formats. The control has multiple built-in features that allow users to shape and edit data.
The control does not work with data directly. It serves as a container for Views that connect to data, display it in various formats, and implement end-user interaction. The Data Grid can contain one view or multiple views in a master-detail relationship. To manage view hierarchies, you can use grid levels.
Available Views
- Table View (unbound, bound, and Server Mode
- This View displays data in a table (in a manner similar to a standard VCL data grid).
- Banded Table View (unbound, bound, and Server Mode)
- This is an enhanced version of a Table View that supports customizable cell layout in rows. You can also join columns under higher-level headers called Bands.
- Card View (unbound and bound)
- This View displays records in blocks similar to contact cards.
- Layout View (unbound and bound)
- This View displays data records as cards with a customizable layout.
- Chart View (unbound and bound)
- This View allows you to display data as bar, column, line, area, and pie diagrams. A Chart View displays only one diagram at a time.
- WinExplorer View (unbound and bound)
- This view supports the same display modes as those found in Microsoft Windows Explorer: Small, Medium, Large, Extra-Large, List, Tiles, and Content.
Bind to Data
A View uses a data controller to load data from the specified source. Each View supports different data controllers designed to work in different data access modes:
- Bound
- A grid View connects to a dataset and loads all data records into memory. All data shaping operations are done on the client machine.
- Unbound
- A grid View is not bound to a dataset and manages data preloaded into a data controller.
- Provider
- A grid View loads data from a custom data source on demand.
- Server
- A grid View loads data from a supported database on demand. The current server mode implementation supports Microsoft SQL Server, Microsoft Access, MySQL, Firebird, InterBase (except for query-based server mode data sources), Oracle, Advantage, PostgreSQL, and SQLite databases.
Main API Members
The list below outlines key members of the TcxGrid
class that allow you to manage grid Views and levels as well as to customize general layout and appearance settings.
- Create a new grid View (CreateView).
- Access a View by its index (Views).
- Obtain the total number of Views (ViewCount).
- Access the View associated with the active root level (ActiveView).
- Specify the active root level (ActiveLevel).
- Access the collection of root grid levels (Levels).
- Associate the control with a source image list for grid level tab and column header glyphs (Images).
- Customize the appearance of the control, its root level, and level tabs (LookAndFeel, RootLevelOptions, and LevelTabs).
- Refresh content in response to control layout or size changes (LayoutChanged and SizeChanged).
- Respond to control layout changes (OnLayoutChanged).
- Redraw the control (Invalidate).
- Avoid excessive redraw operations during batch appearance and content changes (BeginUpdate, CancelUpdate, and EndUpdate).
- Specify if a user can press Tab to focus the Data Grid control (TabStop).
- Move focus between grid Views (FocusedView).
- Respond to navigation between Views and child levels (OnFocusedViewChanged, OnActiveTabChanged, and OnActiveTabChangedEx).
- Adjust Locked View image appearance settings (LockedStateImageOptions).
- Custom draw the Locked View image (OnPrepareLockedStateImage).
Get Started
The following tutorials help you get acquainted with the Data Grid control and its Views:
- Table View
- This tutorial describes how to add a Data Grid control to your application and set up a Table View display style.
- Banded Table View
- This tutorial describes how to add a Data Grid control, specify data connections, and adjust appearance settings in a Banded Table View.