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.

GGC Sorting Header Row

Thread ID:

Created:

Updated:

Platform:

Replies:

82652 Jun 18,2009 05:28 AM Jun 26,2009 07:49 AM Windows Forms 4
loading
Tags: GridControl
samanvay Gupta
Asked On June 18, 2009 05:28 AM

Hi,

Can you please help me to sort header row of GGC.
I want to sort header row using a field which is in the same datasource but not binded to the header or child row.

Here is the code I am using to bind the GGC

grdWbsTask.DataSource = ProjectScopeManager.ScopeSubTaskDT;
grdWbsTask.ChildGroupOptions.CaptionText = "{Category}";

grdWbsTask.TableDescriptor.GroupedColumns.Add("group");
GridColumnDescriptor subTaskName = new GridColumnDescriptor();
subTaskName.Name = "name";
subTaskName.MappingName = "name";
subTaskName.HeaderText = "Name";
grdWbsTask.TableDescriptor.Columns.Add(subTaskName);

GridColumnDescriptor constantHours = new GridColumnDescriptor();
constantHours.Name = "loe_constant_hours";
constantHours.MappingName = "loe_constant_hours";
constantHours.HeaderText = "LOE(Hours)";
grdWbsTask.TableDescriptor.Columns.Add(constantHours);

Thanks
Saman

Lingaraj S [Syncfusion]
Replied On June 20, 2009 07:29 AM

Hi Samanvay,

Thank you for your interest in Syncfusion product.

I am unable to reproduce the issue in sorting, when the column has been added manually in GridGroupingControl. I have created the sample with specified your code in GridGroupingControl, the header sorting had performed in GridGroupingControl. Also I have attached the sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/Forums/GGCBindColumn.zip

This sample shows the sorting in GridGroupingControl.

Please try this sample, let me know if I misunderstood the query.

Regards,
Lingaraj S.

samanvay Gupta
Replied On June 22, 2009 06:52 AM

Hi Lingaraj,

Thanks for your quick comment on this. I probably could not explain the problem correctly.

Attached is the sample which I have created to explain the problem. In this sample I would like to sort header row (currently 3 rows) programmatically by "task index" field. Currently header rows are sorted based on thier caption.

task index field is associated with child rows but it will remain same for all the rows of that group

Thanks
Saman





GGCControl_3e96c1fb.zip

samanvay Gupta
Replied On June 25, 2009 03:29 AM

Hi Lingaraj,

I would really appreciate if you look into this ASAP.

Thanks,
Samanvay

Lingaraj S [Syncfusion]
Replied On June 26, 2009 07:49 AM

Hi Samanvay,

Thank you for the update.

If you want to sort grouped column by clicking another column, then please try using ListSortSortDirection property in GroupedColumns by applying in TableControlCellClick event to achieve this behavior.

Refer the code below:

void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo sty = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (sty.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && sty.TableCellIdentity.Column.Name == "task_index")
{
System.ComponentModel.ListSortDirection sort= this.gridGroupingControl1.TableDescriptor.GroupedColumns["group"].SortDirection;
if (sort == ListSortDirection.Ascending)
{
sort = ListSortDirection.Descending;
this.gridGroupingControl1.TableDescriptor.GroupedColumns["group"].SortDirection = sort;
}
else
{
sort = ListSortDirection.Ascending;
this.gridGroupingControl1.TableDescriptor.GroupedColumns["group"].SortDirection = sort;
}
e.Inner.Cancel = true;
}
}


Refer the modified sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/Forums/GGCControlModified.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

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.

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.

;