We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Top Level Group Summary Caption Row

Hi, I see that Both ChildGroupOptions and TopLevelGroupOptions have a ShowColumnHeaders property attached to them. If I set the TopLevelGroupOptions.ShowColumnHeaders to true, what does that control? Does it show the column headers on top of the Top Level Group or below the Top Level Group Caption row. We are trying to show the Grand Totals at the top of the grid so we are using TopLevelGroupOptions.ShowCaptionSummaryCells and that works fine in showing the totals but the top level group has no column headers associated with it so the user will not be able to tell which values are for which columns. Is there a way to do this?

8 Replies

AD Administrator Syncfusion Team February 8, 2005 04:48 PM UTC

Hi Erlly, the ShowColumnHeaders will show the column headers row below the caption row. But you can customize this and rearrange the order of sections any way you want. Check out the OnInitializeSections method in CustomEngine.cs of the sample CustomSectionInGroup. In that method you could specify that column header should be displayed before the caption row if you add a call to Sections.Add(ParentTableDescriptor.CreateColumnHeaderSection(this)) before the caption row. Stefan >Hi, >I see that Both ChildGroupOptions and TopLevelGroupOptions have a ShowColumnHeaders property attached to them. If I set the TopLevelGroupOptions.ShowColumnHeaders to true, what does that control? Does it show the column headers on top of the Top Level Group or below the Top Level Group Caption row. >We are trying to show the Grand Totals at the top of the grid so we are using TopLevelGroupOptions.ShowCaptionSummaryCells and that works fine in showing the totals but the top level group has no column headers associated with it so the user will not be able to tell which values are for which columns. Is there a way to do this?


EB Erlly Bayuelo February 11, 2005 06:22 PM UTC

I overrode OnInitializeSections() and added the command to add a column header row before the caption row and that works good but now I have two column header rows. One before the caption and one after. I think one is being created automatically during group creation. Is there anyway to just have one before the caption row? Also when I collapse the top level group both captions disappear. I want the top level caption to still show even though the top level group is collapsed.


AD Administrator Syncfusion Team February 11, 2005 08:56 PM UTC

Errly, GridGroup.OnInitializeSections will add a column header row. So, if you override that method and call its base class version it will add a second column header row. If you want to go the route to override this method and call its base class you could set GroupOptions.ShowGroupHeader = false. Then it will not add it again. My orginal idea was actually not to call the base class (as shown in the mentioned sample) but your approach should also be fine. The visibility of the Column Headers is defined by the IsChildVisible method. In it you can check if the queried element is a column header row and if that is the case return true. Stefan >I overrode OnInitializeSections() and added the command to add a column header row before the caption row and that works good but now I have two column header rows. One before the caption and one after. I think one is being created automatically during group creation. Is there anyway to just have one before the caption row? > >Also when I collapse the top level group both captions disappear. I want the top level caption to still show even though the top level group is collapsed. > >


EB Erlly Bayuelo February 11, 2005 10:35 PM UTC

Hi, I am not calling the base class. This is basically my code: public class GroupingEngineFactory : GridEngineFactoryBase { public override GridEngine CreateEngine() { return new GroupingEngine(); } } public class GroupingEngine : GridEngine { public override Syncfusion.Grouping.CaptionRow CreateCaptionRow(Syncfusion.Grouping.CaptionSection parent) { return new CustomCaptionRow(parent); } public override Group CreateGroup(Section parent) { return new CustomGridGroup(parent); } public override ChildTable CreateChildTable(Element parent) { return new CustomGridChildTable(parent); } } public class CustomGridChildTable : Syncfusion.Windows.Forms.Grid.Grouping.GridChildTable { public CustomGridChildTable (Syncfusion.Grouping.Element element): base(element) { } protected override void OnInitializeSections(bool hasRecords, SortColumnDescriptorCollection fields) { //Column Headers this.Sections.Add(ParentTableDescriptor.CreateColumnHeaderSection(this)); // Caption this.Sections.Add(this.ParentTableDescriptor.CreateCaptionSection(this)); // AddNewRecord AddNewRecordSection addNewRecordSectionBeforeDetails = this.ParentTableDescriptor.CreateAddNewRecordSection(this); addNewRecordSectionBeforeDetails.IsBeforeDetails = true; this.Sections.Add(addNewRecordSectionBeforeDetails); // Details (Records or Groups) if (hasRecords) this.Sections.Add(this.ParentTableDescriptor.CreateRecordsDetails(this, fields)); else this.Sections.Add(this.ParentTableDescriptor.CreateGroupsDetails(this, fields)); // Summary this.Sections.Add(this.ParentTableDescriptor.CreateSummarySection(this)); } }


AD Administrator Syncfusion Team February 11, 2005 10:47 PM UTC

Errly, ok. Since you are only interested in modifying TopLevelGroup you can uncomment these lines: public override Group CreateGroup(Section parent) { return new CustomGridGroup(parent); } The IsChildVisible override is missing. You need to return true when the element is a ColumnHeaderSection. Otherwise call base class. Stefan


AN Alexander Nezamaev April 20, 2006 07:44 AM UTC

Hi! Ihave a same problem - but not understand how right to override OnInitializeSections(GroupingGroup) and OnInitializeSections(GroupingChildTable). or two headers or disappear headers or disappear summary or disappear few detailsRow Thanks! >Errly, > >ok. > >Since you are only interested in modifying TopLevelGroup you can uncomment these lines: > >public override Group CreateGroup(Section parent) >{ >return new CustomGridGroup(parent); >} > >The IsChildVisible override is missing. You need to return true when the element is a ColumnHeaderSection. Otherwise call base class. > >Stefan > >

CustomEngine.zip


AD Administrator Syncfusion Team April 21, 2006 06:21 AM UTC

Hi Alexander, The OnInitializeSections in GridChildTable can be override to customize (add/remove) sections in the table level, and the OnInitializeSections in the Group can be override to customize the sections in the group level. And to hide/show the elements (like caption, etc) the IsChildVisible method must be override and there you can check for the condition and return true to show or false if not. Please make the below changes in the CustomEngine.cs file that you send. Let us know if this helps. public override Group CreateGroup(Section parent) { //return base.CreateGroup(parent); return new GroupingGroup(parent); //have to return the custom Group class to customize the Group. } protected override void OnInitializeSections(bool hasRecords, SortColumnDescriptorCollection fields) { // Caption this.Sections.Add(this.ParentTableDescriptor.CreateCaptionSection(this)); // // Column Headers this.Sections.Add(ParentTableDescriptor.CreateColumnHeaderSection(this)); // Summary //this.Sections.Add(this.ParentTableDescriptor.CreateSummarySection(this)); Remove this to not to show the summary in the table level if (hasRecords) this.Sections.Add(this.ParentTableDescriptor.CreateRecordsDetails(this, fields)); else this.Sections.Add(this.ParentTableDescriptor.CreateGroupsDetails(this, fields)); this.GroupOptions.ShowColumnHeaders = false; this.GroupOptions.ShowSummaries = false; } Regards, Calvin.


AD Administrator Syncfusion Team April 21, 2006 06:30 AM UTC

Hi Alexander, The changes that I have mention in the OnInitializeSections is under the class GroupingChildTable. public class GroupingChildTable : GridChildTable { ................ ...................... protected override void OnInitializeSections(bool hasRecords, SortColumnDescriptorCollection fields) { // Caption this.Sections.Add(this.ParentTableDescriptor.CreateCaptionSection(this)); // // Column Headers this.Sections.Add(ParentTableDescriptor.CreateColumnHeaderSection(this)); // Summary //this.Sections.Add(this.ParentTableDescriptor.CreateSummarySection(this)); Remove this to not to show the summary in the table level if (hasRecords) this.Sections.Add(this.ParentTableDescriptor.CreateRecordsDetails(this, fields)); else this.Sections.Add(this.ParentTableDescriptor.CreateGroupsDetails(this, fields)); this.GroupOptions.ShowColumnHeaders = false; this.GroupOptions.ShowSummaries = false; } ................... ........... } Regards, Calvin.

Loader.
Up arrow icon