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
close icon

Sorting on child grid

Hi,

I am using GGC. I have child table created using the master detail relationship and add under is group. When i sort the Grid Column On grouping summary i want my Child table columns should also get sorted accordingly....
Please tell me how to sort the child table column on click on parent table column heading.

Thanks
Harshad

1 Reply

HA haneefm Syncfusion Team June 25, 2007 03:52 PM UTC

Hi Harshad,

This can be achieved by handling a the TableControlQueryAllowSortColumn event handler and add the new sortcolumn to the child table based on the parent table. Here is a code snippet to show this.

void hierarchyGrid_TableControlQueryAllowSortColumn(object sender, GridQueryAllowSortColumnEventArgs e)
{
if (e.Column.Name == "parentID")
{
bool IsSortedColumn = e.TableControl.TableDescriptor.SortedColumns.Contains(e.Column.Name);
ListSortDirection direction = ListSortDirection.Ascending;
if (IsSortedColumn)
{
direction = e.TableControl.TableDescriptor.SortedColumns[e.Column.Name].SortDirection;
}
GridGroupingControl grid = sender as GridGroupingControl;
GridTableDescriptor td = grid.GetTableDescriptor("ChildTable");
td.SortedColumns.Clear();
td.SortedColumns.Add("childID", direction);
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon