DBGrid - Group header lazarus / 16-Databases ---------------------------------------------------------------------- pcurtis · 2020-07-21 13:38 Hi All, Is it possible group displayed data in a DBGrid and display the group  title as a header? Thanks in advance. ---------------------------------------------------------------------- rvk · 2020-07-21 13:50 Quote from: pcurtis on July 21, 2020, 03:38:53 pmIs it possible group displayed data in a DBGrid and display the group  title as a header? You might want to be a bit more specific. If you are using TDBGrid, the columns come from the SQL statement. You can do a lot there. You can also CONCATENATE multiple fields into one field (which is what it looks like you're after). ---------------------------------------------------------------------- pcurtis · 2020-07-21 14:10 I know how to group in sql, but I want the grid to display the group (in effect GROUPED BY column) as a header row then the details below it. I know this can be done in RxDB grid, but as a footer. ---------------------------------------------------------------------- rvk · 2020-07-21 14:18 This can't be done in TDBGrid. I don't know TRxDBGrid but you might try that one then... or even change it to your needs. ---------------------------------------------------------------------- pcurtis · 2020-07-21 14:23 If I was able to change it I wouldn't be asking ---------------------------------------------------------------------- rvk · 2020-07-21 14:24 Then you will first need to draw a sketch of exactly what you want (because I still didn't really get it). Is it something like this: http://freepascal.ru/forum/viewtopic.php?f=18&t=4743#p39711 Or do you really want to collapse groups by + sign? ---------------------------------------------------------------------- pcurtis · 2020-07-21 15:04 It would look something like this https://i.stack.imgur.com/mJAYO.jpg Sorry, I don't speak Russian. ---------------------------------------------------------------------- wp · 2020-07-21 15:21 I think you can achieve this with VirtualTreeView. ---------------------------------------------------------------------- pcurtis · 2020-07-21 15:48 Could you be more specific please. I'm not the best of programmers. ---------------------------------------------------------------------- paweld · 2020-07-21 15:52 TMS FNC UI Pack: https://www.tmssoftware.com/site/tmsfncuipack.asp ---------------------------------------------------------------------- pcurtis · 2020-07-21 16:04 Looks good but not free ---------------------------------------------------------------------- wp · 2020-07-21 17:12 Quote from: pcurtis on July 21, 2020, 05:48:20 pmCould you be more specific please. I'm not the best of programmers. I don't want to spend the time to create a demo for you without further information. Is this a DB-aware application? Can you post a sample data file,  maybe with dummy data, just to see the structure, as CSV or dbase (I don't want to install a big db server just for this sample). ---------------------------------------------------------------------- pcurtis · 2020-07-22 01:35 @wp - Here's the DB. It's a SQLite3 DB. I want to group by field fnALBUM. Thanks for your help. ---------------------------------------------------------------------- wp · 2020-07-22 16:29 So, here is a demo showing a VirtualTreeView with your dataset. You can expand/collapse every album to see/hide the titles. I added a lot of comments to explain what the events are good for - I know the learning curve for VirtualTreeView is said to be steep... I know there there is also a data-aware version which will help you in needing less code, but I never worked with it. VirtualTreeView is provided by default in Laz 2.0.x, there's nothing to download. But note, if you work with Laz-trunk, you must know that the component has been renamed to have a "Laz" prefix in order to avoid naming conflicts with other VTV versions out there. ---------------------------------------------------------------------- pcurtis · 2020-07-22 20:55 OMG  I didn't expect that kind of help. Amazing. Thank you so much. Now I have a lot of work to do.  Thank you again.