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

Showing RecordPlusMinus button for specific row

I want to "simulate" nested tables without actually having table relations. What I need to be able to do is to activate the RecordPlusMinus button for a specific row and then I'll hook onto the RecordExpanding event to perform my "simulated" nested table handling. The following code is where I'm at but it is obviously not working. Any ideas?

private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
GridVisibleColumnDescriptor firstColumn = gridGroupingControl1.TableDescriptor.VisibleColumns[0];
GridColumnDescriptor column = e.TableCellIdentity.Column;
if (column != null && firstColumn != null && column.Name == firstColumn.Name)
{
Record record = e.TableCellIdentity.DisplayElement.ParentRecord;
if (record != null &&
record.ParentTable.TableDescriptor.Name == _myDataTable.TableName)
{
e.TableCellIdentity.TableCellType = GridTableCellType.RecordPlusMinusCell;
e.Style.CellType = "NestedTable Row Header";
}
}
}


1 Reply

AD Administrator Syncfusion Team March 15, 2008 04:18 AM UTC

Hi Derrick,

Sorry for the delay in responding.

If your intention is to prevent the Plus/Minus symbol of the Parent table when there is no record in the Child table, it can be achieved by the following code:


[C#]
protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordPlusMinusCell)
{
Record r = e.TableCellIdentity.DisplayElement.ParentRecord as Record;
if (r != null && r.NestedTables.Count > 0 && r.NestedTables[0].ChildTable.FilteredChildNodeCount == 0)
{
e.Style.CellType = "Static";
}
}
}


Please refer the below KB link to get more details and sample which illustrates the above:

http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=311

If I have misunderstood your requirement, could you please explain me in detail, so that I can work in
depth and try to send a better solution?

Regards,
G.Yavana


Loader.
Live Chat Icon For mobile
Up arrow icon