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. Image for the cookie policy date

GCC: how to hide header of empty child table

Hi,

I have a nested table using GCC. If a child table has data, it display well. However if child table does not have any data row, it shows the header only, and this make user a bit confusing (like in the attached image).

Is there a way to hide header of empty child table? If there is, please tell me ^_^.

Thanks and regards,

Cuong Luc.

sample89.zip

3 Replies

AD Administrator Syncfusion Team December 18, 2006 11:49 AM UTC

Hi Cuong,

You could try this in the QueryCellStyleInfo event handler. Here is some code that hides the +/- pushbutton for the records that doesn't have child records, you can handle the QueryCellStyleInfo checking for the nestedtable's record count and set the +/- pushbutton celltype to Static/Header.

private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if(e.Style.CellType == "PushButton")
{
if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Record rec = (Record) e.TableCellIdentity.DisplayElement.ParentRecord;
if(rec.NestedTables[0].FilteredRecords.Count == 0)
{
e.Style.CellType = "Static";
e.Style.Enabled = false;
}
}
}
}

Please refer to the attached sample for implementation.
Here is a sample

Best regards,
Haneef


CL Cuong Luc December 20, 2006 09:14 AM UTC

Thanks for your help, Haneef. If we use this approach, there's a white space for each "Static" cell. I think it's better if the first column (the tiny column on the left that has the black arrow) is hidden. Could I make it hidden?

Regards,

Cuong Luc.

>Hi Cuong,

You could try this in the QueryCellStyleInfo event handler. Here is some code that hides the +/- pushbutton for the records that doesn't have child records, you can handle the QueryCellStyleInfo checking for the nestedtable's record count and set the +/- pushbutton celltype to Static/Header.

private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if(e.Style.CellType == "PushButton")
{
if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
{
Record rec = (Record) e.TableCellIdentity.DisplayElement.ParentRecord;
if(rec.NestedTables[0].FilteredRecords.Count == 0)
{
e.Style.CellType = "Static";
e.Style.Enabled = false;
}
}
}
}

Please refer to the attached sample for implementation.
Here is a sample

Best regards,
Haneef


AD Administrator Syncfusion Team December 20, 2006 09:31 AM UTC

Hi Cuong,

Try setting the TableOptions.ShowRowHeader property to hide/show the first column(rowheader) of the Grid. Here is a code snippet

this.gridGroupingControl1.TableOptions.ShowRowHeader = false;

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon