Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 May 2020, 06:40

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 27 Jan 2020, 10:22 
Offline

Joined: 14 Mar 2018, 15:34
Posts: 7
Hello friends out there,

I'm in need to manually setup grouping in DBGridEh. This is needed, as we usually modify the SQL statement accessing the SQL-Server. However, this kills the complete grouping (underlying MemTableEh is closed thus losing all the Fields from DBGridEh.DataGrouping.GroupLevels).

So we need to restore this manually. But: There is no "ColumnName" in any of the properties accessible by code - this property only exists in Designer. As usual the example is ultra simple showing only the extreme basics, Docs do not tell us anything more.

So: How do we restore the grouping in code ?

Thanks for help !


Top
 Profile  
 
PostPosted: 27 Jan 2020, 14:02 
Offline

Joined: 08 May 2014, 18:06
Posts: 392
Hello

You can use TGridDataGroupLevelEh.Column to assign column for a GroupLevel.

Here is an code example:

Code:
procedure TForm1.Button1Click(Sender: TObject);
var
  grLevel: TGridDataGroupLevelEh;
begin
  DBGridEh1.DataGrouping.Active := False;
  grLevel := DBGridEh1.DataGrouping.GroupLevels.Add;
  grLevel.Column := DBGridEh1.FieldColumns['Capital'];
  DBGridEh1.DataGrouping.Active := True;
end;


TDBGridEh.FieldColumns finds and returns column by column.FieldName property.

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 28 Jan 2020, 10:00 
Offline

Joined: 14 Mar 2018, 15:34
Posts: 7
This worked great, thanks a lot !


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group