The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I''m trying to use a Grouping.Engine as the data for a GridControl running in virtual mode. The reason I''m not using GridGroupingControl is because I want the grouping rows to be multiple cells and I can''t figure out how to make GridGroupingControl do that.
It''s working OK except that when I query DisplayElements.Count, I get elements for AddNewRecord and SummarySection, which I don''t want. If I were using a GridGroupingControl, I could just turn them off in the TableOptions. Is there anything similar in the engine?
Or, to solve the problem a different way, can I get multiple columns in the grouping rows in the GridGroupingControl?
ADAdministrator Syncfusion Team March 10, 2004 12:04 AM UTC
Hi Justin,
to get rid of these section you need to derive from Engine class and override the CreateGroup and method. In your override you can then just add the sections you want, e.g:
public class GroupingEngine : Engine
{
public override Group CreateGroup(Section parent)
{
return new GroupingGroup(parent);
}
}
public class GroupingGroup : Group
{
public GroupingGroup(Section parent)
: base(parent)
{
}
protected override void OnInitializeSections(bool hasRecords, SortColumnDescriptorCollection fields)
{
this.Sections.Add(this.ParentTableDescriptor.CreateCaptionSection(this));
if (hasRecords)
this.Sections.Add(this.ParentTableDescriptor.CreateRecordsDetails(this, fields));
else
this.Sections.Add(this.ParentTableDescriptor.CreateGroupsDetails(this, fields));
this.Sections.Add(this.ParentTableDescriptor.CreateSummarySection(this));
}
public override bool IsChildVisible(Element el)
{
if (el is CaptionSection)
{
return true;
}
else if (el is DetailsSection)
{
return this.IsExpanded;
}
else if (el is SummarySection)
{
return this.IsExpanded;
}
return true;
}
}
but I think you should stick with grouping control. You can make the caption have multiple columns when you handle the QueryCoveredRange event of GridGroupingControl.TableControl.Model.
void ModelQueryCoveredRange(object sender, GridQueryCoveredRangeEventArgs e)
{
GridTable thisTable = grid.Table;
if (e.RowIndex < thisTable.DisplayElements.Count)
{
Element el = thisTable.DisplayElements[e.RowIndex];
switch (el.Kind)
{
case DisplayElementKind.Caption:
e.Handled = true;
break;
}
}
}
Setting e.Handled will prevent the GridTable class from setting a covered range for captions.
Stefan