3

I need to add a simple style to a Tableview based on a query in Delphi. I need it to look like this:

enter image description here

I know there's a way to group by fields, but I can't seem to figure out how to add the 2 main title fields to the header of the table.

Jasper
  • 185
  • 1
  • 2
  • 7

2 Answers2

6

This can be done using the BandedTableView. This view allows you to arrange columns by Bands (in your case, there will be two bands: Main title1 and Main title 2. NOTE, that it is impossible to show a column without a band in this view. So, you will also have to create an additional band for the Prim_Key column.

DevExpress Team
  • 11,338
  • 2
  • 24
  • 23
0

I would do something like this

First Clear the bands in your grid

for I := 0 to YourGrid.bands.count-1
YourGrid.bands[I].Free; 

You then create the header bands

CreateBands('Prime key Header',YourGrid);
CreateBands('Main Title 1 Header',YourGrid);
CreateBands('Main Title 2 Header',YourGrid);

You then hook up your columns to the Bands index

for I := 0 to YourGrid.ColumnCount - 1 do
begin
 if (YourGrid.Columns[I].Caption = 'prim_key') then
  YourGrid.Columns[I].Position.BandIndex := 0

end;
Chrismas007
  • 6,085
  • 4
  • 24
  • 47