AD
Administrator
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
JK
Justin Koh
March 10, 2004 01:08 PM UTC
Thank you, Stefan. I''ll give it a shot.