Hi laxou,
Issue 1: TrackWidthOfParentColumn
>>>>>>>>>>
You can use the below code snippet to resolve this issue.
private void SetTrackWidthOfParentColumn( GridTableDescriptor descriptor)
{
if (descriptor == null) return;
foreach (GridRelationDescriptor relationDescriptor in descriptor.Relations)
{
for (int n = 0; n < relationDescriptor.ChildTableDescriptor.VisibleColumns.Count ; n++)
{
relationDescriptor.ChildTableDescriptor.Columns[n].ResetTrackWidthOfParentColumn();
relationDescriptor.ChildTableDescriptor.Columns[n].TrackWidthOfParentColumn = relationDescriptor.ParentTableDescriptor.Columns[n].Name;
}
SetTrackWidthOfParentColumn(relationDescriptor.ChildTableDescriptor);
}
}
For call the above method, please use this
SetTrackWidthOfParentColumn(this.gridGroupingControl1.TableDescriptor);
Issue 2: Sumarry
>>>>>>>>>
You need to add the SummaryRowDescriptor for each self relation table in a GroupingGrid. Below are the codes that shows you "How to add the Count summary for SelfRelation table in GroupingGrid?".
private GridRelationDescriptor AddManualRelations( GridTableDescriptor parentgridTableDescriptor )
{
GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor( );
parentToChildRelationDescriptor.ChildTableName = "SelfReferencingTable"; // same as SourceListSetEntry.Name for childTable (see below)
parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails;
parentToChildRelationDescriptor.RelationKeys.Add( "DEPTNO", "ADMRDEBT" );
// Add relation to ParentTable
parentgridTableDescriptor.Relations.Add( parentToChildRelationDescriptor );
parentgridTableDescriptor.AllowNew = false;
parentgridTableDescriptor.AllowEdit = false;
GridSummaryColumnDescriptor totalSum = new GridSummaryColumnDescriptor("CumBuyQty");
totalSum.SummaryType = SummaryType.Count;
totalSum.Style = GridSummaryStyle.Column;
totalSum.DataMember = "DEPTNO";
totalSum.DisplayColumn = "DEPTNO";
totalSum.Format = "{Count:#}";
GridSummaryRowDescriptor sRow = new GridSummaryRowDescriptor("Totals", totalSum);
parentToChildRelationDescriptor.ChildTableDescriptor.SummaryRows.Add(sRow);
return parentToChildRelationDescriptor;
}
Issue 3: ReadOnly
>>>>>>>>>>
You need to set the AllowEdit property of the TableDescriptor to true. Below are the codes:
parentgridTableDescriptor.Relations.Add( parentToChildRelationDescriptor );
parentgridTableDescriptor.AllowNew = false;
parentgridTableDescriptor.AllowEdit = false;
//OR
You can handle the CurrentCellStartingEditing event of the GroupingGrid and set the e.Inner.Cancel to TRUE for all parentable.
Please refer to the attached sample for implementation and let me know if this helps.
http://websamples.syncfusion.com/samples/ModifiedSelfRelations.zipBest regards,
Haneef