Another problem with GridDatbaseAdapter - Grouping.

Interesting that two people almost simultaneously encountered problems with GridDatbaseAdapter. Unlike my colleague, my data loads, but I have problems with its grouping. I am using the latest version of the 5.01 package and Lazarus 2.2.4.

So what happens:

  1. At the beginning, you need to open the MemDataSet demo from the LCL directory. This example from TMS does not work (for years), but fortunately you can easily fix it yourself. To do this, you should ignore the numerous error messages and find the wrong color definitions in either the *.lfm file or the inspector and correct them to the default values. After manually fixing the broken code, the demo should run.

  2. I changed the content of the base so that there is something to group (not necessary to see the error) , and then added such code (works without GridDatbaseAdapter):
    TMSFNCGrid1.Options.Grouping.MergeHeader := true;
    TMSFNCGrid1.SortGrouped(2, sdAscending);

And it doesn't work. There is an error because it tries to group always first field from the DataSet - which makes no sense at all. Could someone take a look to see if this works in Delphi (DataSet type should be changed, of course)? Am I doing something wrong? I'm afraid it's a more serious bug. :frowning:

Grouping in combination with an active dataset is not possible unfortunately. You need to load all the data in the grid first with TMSFNCGridDatabaseAdapter1.LoadAllDataAndDisconnect and then apply grouping.