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.
Unfortunately, activation email could not send to your email. Please try again.

How to implement a scene like the "NestedSummary2005" sample using GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

72215 Mar 9,2008 10:28 PM Mar 27,2008 11:05 AM Windows Forms 2
loading
Tags: GridControl
laoxu
Asked On March 9, 2008 10:28 PM

I have a self-referential table with "ID","NAME","COST" and "FID" fields.The self-referential level isn't constant.The data_relation is between "ID" and "FID" fields.
1.How to make "ID","NAME","COST" columns as same width using TrackWidthOfParentColumn property in a loop code?
2.When a record at level n gets a child table and its "COST" field value changed event raises,how to set "COST" field value at level n-1 table as sum of "COST" field value at level n table,"COST" field value at level n-2 table as sum of "COST" field value at level n-1 table...so on.
3.When a record gets a child table,how to make it "readonly".

Regards,
LaoXu


Administrator [Syncfusion]
Replied On March 17, 2008 11:12 AM

Hi Laoxu,

we are working on the forum.. we will update you soon.. Thanks for your interest in syncfusion products..

regards,
Janagan


Administrator [Syncfusion]
Replied On March 27, 2008 11:05 AM

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.zip


Best regards,
Haneef



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;