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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid to not Expand Child with no data

Thread ID:

Created:

Updated:

Platform:

Replies:

42938 Apr 10,2006 10:19 PM UTC Jul 11,2011 06:21 AM UTC WinForms 8
loading
Tags: GridControl
Chris Wescott
Asked On April 10, 2006 10:19 PM UTC

Hi, I am having an issue with your grid grouping control. I have a parent Child table relation type grid and some parents have no children. However when I use the command GridGroupingControl1.Table.ExpandAllRecords() It expands the parents with no children and shows the column headers of the child table. Is there a way to either cancel the row.expanding method or to set the grid to not expand parents with no children. I have removed the plus signs by making the cell = "Static" but GridGroupingControl1.Table.ExpandAllRecords seems to ignore that the parents have no plus sign. Regards, Chris Wescott

Administrator [Syncfusion]
Replied On April 11, 2006 07:10 AM UTC

Hi Chris, The parent records that have no child record can be prevented from expanding by handling the Table.RecordExpanding event and by setting the e.Cancel to true when there is no child records for a parent record. Below is a code snippet. private void Table_RecordExpanding(object sender, RecordEventArgs e) { if(e.Record.GetRelatedChildTable(new RelationDescriptor("ParentToChild")).GetRecordCount() == 0) e.Cancel = true; } Regards, Calvin.

Chris Wescott
Replied On April 11, 2006 08:06 PM UTC

Hi, This doesn''t seem to work perhaps I am firing it on the wrong event but there is no table.recordexpanding event for the GGC Here is a code snippet Private Sub GridGroupingControl1_RecordExpanding(ByVal sender As System.Object, ByVal e As Syncfusion.Grouping.RecordEventArgs) Handles GridGroupingControl1.RecordExpanding If e.Record.HasNestedTables = False Then e.Cancel = True End If End Sub Vb Examples are best for me as that is what I am writing in, any ideas? Thanks, Chris Wescott

Administrator [Syncfusion]
Replied On April 12, 2006 05:36 AM UTC

Hi Chris, Attached is a sample in both CS and VB. Regards, Calvin.

42938.zip

Chris Wescott
Replied On April 12, 2006 01:39 PM UTC

Thanks Calvin, It works Great!!!

avinash
Replied On February 24, 2011 10:33 PM UTC

I am not able to download the code.


Jisha Joy [Syncfusion]
Replied On February 25, 2011 05:04 AM UTC

Hi Avinash,

I could able to download it. Please use the following link to the sample.

Regards,
Jisha



42938_cdd76c6d.zip

rayzhahng
Replied On July 9, 2011 09:21 PM UTC

Hi,

Anyone can tell me how to get rid of the plus/minus sign if the parent record does not have any childrens?


And is it possible to move the plus/minus sign to some other cell instead of the first cell if the parents do have childrens?

Thanks much


Jisha Joy [Syncfusion]
Replied On July 11, 2011 06:21 AM UTC

Hi,

The ChildTable can be made hidden when it has no records to show up, by having a CustomEngine. Derive the GridChildTable in the CustomGroupingEngine and override the GetVisibleCount(), there check whether Records.Count equals 0 for the childtable and return 0. This will make the ChildTable to be hidden when it has no records to show.
In addtion, if the +/- buttons also has to be hidden then, the QueryCellStyleInfo event of the GridGroupiingControl can be handled to do this.
Please refer to the sample,

http://help.syncfusion.com/samples/kb/grid.windows/GGCHideEmptyChildTable/HideEmptyChildTables.zip


Regards,
Jisha


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.

Warning Icon 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.Close Icon

;