close×
Steema Documentation / TeeBI VCL/FMX / Tutorials

Grids

Grids

Any TDataItem (and its children items, sub-items and master-detail related data items) can be visualized using a "grid" control.

The BI.VCL.Grid and BI.FMX.Grid units implement a container control for a "real" grid.

The default Grid control used to display data is the VCL TDBGrid and the Firemonkey TGrid.

Other grid controls can be easily selected, currently being:

  • JVCL Grid ( http://jvcl.delphi-jedi.org )
  • SMDBGrid (VCL http://www.scalabium.com/smdbgrid.htm )
  • TMS Grid for Firemonkey (http://www.tmssoftware.com )
  • Woll2Woll FirePower grid (http://www.woll2woll.com )

The TBIGrid container control is configured by default to enable sorting and filtering by mouse-clicking the grid column headers, using the standard VCL and FMX grid controls included in Delphi.

Other grids might support more advanced features, accessible via this property:

var JGrid : TJVDBGrid;
JGrid := BIGrid1.Plugin.GetControl as TJVDBGrid;

Selecting a grid is done by setting the Plugin property, for example:

BIGrid1.Plugin := TBIJVCLGridPlugin.Create(BIGrid1);

A TDataItem can be displayed onto a BIGrid at runtime in different ways:

-by setting the Data property:

BIGrid1.Data := MyDataItem;

-by setting the DataSource property linked to a BIDataset:

BIDataset1.Data:= MiDataItem;
DataSource1.DataSet:= BIDataset1;
BIGrid1.DataSource:=DataSource1;

-Calling the BIGrid BindTo method:

BIGrid1.BindTo(MyDataItem);

At design-time, the BIGrid Data property can be changed in the Object Inspector, using the Data Manager dialog to select the desired store (local or remote), and the data item to visualize.

Grid Colorizer

A feature of TBIGrid (beta note: VCL only) allows defining a formula to fill the grid cells interior with a color calculated using all cells of a given range.

Several properties allow customizing the number of colors, changing the text font color for better readibility or inverting the formula.

uses BI.UI;
var MyColors : TDataColorizer;
MyColors.Data:= SumOfQuantity;  // <-- The selected TDataItem
BIGrid1.Colorize([ MyColors ]);   // <-- array with one or more items

// optional properties:

MyColors. TextColor:= TColorizeTextColor.Automatic;
MyColors.Inverted:= False;
MyColors.Colors.Clear;
MyColors.Colors.Add(0,TAlphaColors.White);
MyColors.Colors.Add(1,TAlphaColors.Darkblue);

For each "colorizer", the minimum and maximum values of the Data item will be calculated and then each cell value determines the interpolated color used to fill the cell.