how can i create dbgrid with composite columns?
how can i create dbgrid with comp开发者_如何学Goosite columns,
example :dbgrid header | name | | first | last |
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.
You can get such functionality by coding:
- Subclassing a DBGrid
- Virtual TreeView you write the DB access stuff (there are examples on the site), and manage the custom drawing
Or by paying:
- DevExpress is my choice, amazing grids.
- Any other third party grid like the one mentioned EHLib...
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:
(source: ehlib.com)
You can see other screenshots in this link: http://www.ehlib.com/dbgrideh1.htm
精彩评论