khelifaadm
khelifaadm

Reputation: 21

how can i create dbgrid with composite columns?

how can i create dbgrid with composite columns,

example :dbgrid header | name | | first | last |

Upvotes: 1

Views: 4603

Answers (3)

vcldeveloper
vcldeveloper

Reputation: 7489

Standard Delphi DBGrid does not support such feature except for Aggregate field type which is supported only in ClientDataset.

You can use 3rd-party grid components that provide such functionality. I personally like EhLib grid which provides this feature, and lots of other ones. Here is a screenshot of EhLib with nested column headers:

alt text
(source: ehlib.com)

You can see other screenshots in this link: http://www.ehlib.com/dbgrideh1.htm

Upvotes: 0

Mihaela
Mihaela

Reputation: 2502

You can get such functionality by coding:

  1. Subclassing a DBGrid
  2. Virtual TreeView you write the DB access stuff (there are examples on the site), and manage the custom drawing

Or by paying:

  1. DevExpress is my choice, amazing grids.
  2. Any other third party grid like the one mentioned EHLib...

Upvotes: 0

BennyBechDk
BennyBechDk

Reputation: 944

The composition should/has to be done on the dataset (table).
If you use a SQL Selects for getting your data, you shoud make the "composition" in the select statement (syntax depends of the data engine/sql server).
You can also make a calculated field on the datasset (look in help and in the examples installed with delphi.

Upvotes: 2

Related Questions