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.
Syncfusion Feedback

Hiding empty nested table

Thread ID:

Created:

Updated:

Platform:

Replies:

98862 Apr 5,2011 04:08 PM UTC Apr 9,2011 07:27 AM UTC WPF 3
loading
Tags: GridControl
Wale Dada
Asked On April 5, 2011 04:08 PM UTC

Following from sample “Hierarchy Demo” in the Syncfusion Essential Studio 2010 v2: I am trying to create a hierarchical grid such that:
The data context contains a collection of parent(Parents)
parent contains a collection of child(Children)
Children is to be rendered as child rows of a parent.
If Children.Count = 0 don’t display and Children for given parent.

How do I go about this using syncfusion and wpf.

Please see attached source. I am basically trying to get rid of the displayed empty table under parent Bob.

Help will be greatly appreciated. Thanks. Wale



WpfBindingTest_47ba83f5.zip

Rajasekar [Syncfusion]
Replied On April 6, 2011 03:12 PM UTC

Hi Wale,

Thanks for your using Syncfusion products.

You can achieve your requirement by invoking the ‘SetHidden” method of GridDataTable.Model.RowHeights in the RecordExpanding event of the DataGrid.Model.Table like shown below,

Here is the code snippet that resolves the issue.

Code Snippet[C#]

this.summaryDataGrid.Model.Table.RecordExpanded += new System.EventHandler>(Table_RecordExpanded);

void Table_RecordExpanded(object sender, GridDataValueEventArgs e)
{
GridDataTable table = sender as GridDataTable;
GridControlBase gcb = table.Model.Views.First();
Point pt = Mouse.GetPosition(gcb);
RowColumnIndex cell = gcb.PointToCellRowColumnIndex(pt);
GridDataRecord rec = e.Value;
int rowIndex = cell.RowIndex + 1;
int count = rec.ChildViews.Count;
for (int i = 0; i < count; ++i)
{
if (rec.ChildModels[i].RowCount < 2)
{
table.Model.RowHeights.SetHidden(rowIndex, rowIndex, true);
}
rowIndex++;
}
}

Please let us know if you have any queries.

Thanks,
Rajasekar




Administrator [Syncfusion]
Replied On April 7, 2011 08:36 AM UTC

That works fine...thanks. But I would have expected to have a Property support for this.


Rajasekar [Syncfusion]
Replied On April 9, 2011 07:27 AM UTC

Hi Wale,

Thanks for your update.

We will consider this as feature and we will provide you the separate property support for this in our 2011 Vol3 release. We will update you once the feature is implemented. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity.

Please let us know if you have any queries.

Thanks,
Rajasekar


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

;