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.

MultiColumn Sorting in GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

42279 Mar 24,2006 01:21 AM Mar 28,2006 07:19 AM Windows Forms 8
loading
Tags: GridControl
Kai
Asked On March 24, 2006 01:21 AM

Hi, is it possible to have multiple column sorting in GGC? I have tried to do something like: DataView dv = new DataView(someDataTable); dv.Sort = "LastName, FirstName"; GGC.DataSource = dv; However, the displayed data is still unsorted. Any idea?

Administrator [Syncfusion]
Replied On March 24, 2006 02:11 AM

Hi Kai, Yes, it is possible to have multiple column sorts in GridGroupingControl. Below is a code snippet. this.gridGroupingControl1.TableDescriptor.SortedColumns.AddRange(new SortColumnDescriptor[] { new SortColumnDescriptor(colName1, ListSortDirection.Ascending), new SortColumnDescriptor(colName2, ListSortDirection.Descending), new SortColumnDescriptor(colName3, ListSortDirection.Ascending) }); Regards, Calvin.

Kai
Replied On March 24, 2006 04:03 AM

Great! Thanks! >Hi Kai, > >Yes, it is possible to have multiple column sorts in GridGroupingControl. Below is a code snippet. > > >this.gridGroupingControl1.TableDescriptor.SortedColumns.AddRange(new SortColumnDescriptor[] > { > new SortColumnDescriptor(colName1, ListSortDirection.Ascending), > new SortColumnDescriptor(colName2, ListSortDirection.Descending), > new SortColumnDescriptor(colName3, ListSortDirection.Ascending) > }); > > >Regards, >Calvin.

Kai
Replied On March 24, 2006 04:23 AM

Now, how can we enable the Ctrl-left click in GGC for user to do multi-column sorting? >Great! Thanks! > >>Hi Kai, >> >>Yes, it is possible to have multiple column sorts in GridGroupingControl. Below is a code snippet. >> >> >>this.gridGroupingControl1.TableDescriptor.SortedColumns.AddRange(new SortColumnDescriptor[] >> { >> new SortColumnDescriptor(colName1, ListSortDirection.Ascending), >> new SortColumnDescriptor(colName2, ListSortDirection.Descending), >> new SortColumnDescriptor(colName3, ListSortDirection.Ascending) >> }); >> >> >>Regards, >>Calvin.

Administrator [Syncfusion]
Replied On March 24, 2006 05:13 AM

Hi Kai, By default the multi column sort by Ctrl+Left Button Mouse Click is enabled. To enable/disable the multi column sort the AllowMultiColumnSort property must be set to true/false. Below is a code. this.gridGroupingControl1.TableOptions.AllowMultiColumnSort = false; Regards, Calvin.

Kai
Replied On March 26, 2006 09:19 PM

It seems that the AllowMultiColumnSort property does not exists in 3.3 GGC. I have an AllowSortColumns property instead. Are they the same? I have explicitly set the AllowSortColumns property to true but it seems that the Ctrl-left click on column header trick still doesn''t work. Any idea? I have a predefined sorted column header in my form''s constructor. GGC.TableDescriptor.SortedColumns.AddRange(new SortColumnDescriptor[] { new SortColumnDescriptor(Col1), new SortColumnDescriptor(Col2) ... } }; and GGC.TableOptions.AllowSortColumns = true; >Hi Kai, > >By default the multi column sort by Ctrl+Left Button Mouse Click is enabled. To enable/disable the multi column sort the AllowMultiColumnSort property must be set to true/false. Below is a code. > >this.gridGroupingControl1.TableOptions.AllowMultiColumnSort = false; > >Regards, >Calvin.

Administrator [Syncfusion]
Replied On March 27, 2006 10:40 AM

Hi Kai, The latest version (4.1.0.62) can be downloaded from the following link. ftp://syncpatch.syncfusion.com/EssentialStudio/v4.1.0.62/syncfusionessentialstudiosetup.exe In the 3.3 version the intent behavior can be achieved by handling the TableControlCellClick event. Below is code snippet. private void gridGroupingControl1_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e) { // Check for CTRL - Key to do multi-column sorting..... if(((Control.ModifierKeys & Keys.Control) != 0)) { // Cancel the default sorting... e.Inner.Cancel = true; GridColumnDescriptor column = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex, e.Inner.ColIndex); string col = column.Name; if(this.gridGroupingControl1.TableDescriptor.SortedColumns.Contains(col)) { if(this.gridGroupingControl1.TableDescriptor.SortedColumns[col].SortDirection == ListSortDirection.Ascending) { this.gridGroupingControl1.TableDescriptor.SortedColumns[col].SortDirection = ListSortDirection.Descending; } else { this.gridGroupingControl1.TableDescriptor.SortedColumns[col].SortDirection = ListSortDirection.Ascending; } } else { this.gridGroupingControl1.TableDescriptor.SortedColumns.Add(col, ListSortDirection.Ascending); } } } Regards, Calvin.

Kai
Replied On March 28, 2006 12:59 AM

Works great! Can we upgrade from 3.3 to 4.1.0.62 for free? >Hi Kai, > >The latest version (4.1.0.62) can be downloaded from the following link. >ftp://syncpatch.syncfusion.com/EssentialStudio/v4.1.0.62/syncfusionessentialstudiosetup.exe >In the 3.3 version the intent behavior can be achieved by handling the TableControlCellClick event. Below is code snippet. > >private void gridGroupingControl1_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e) > { > // Check for CTRL - Key to do multi-column sorting..... > if(((Control.ModifierKeys & Keys.Control) != 0)) > { > // Cancel the default sorting... > e.Inner.Cancel = true; > > GridColumnDescriptor column = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex, e.Inner.ColIndex); > string col = column.Name; > > if(this.gridGroupingControl1.TableDescriptor.SortedColumns.Contains(col)) > { > if(this.gridGroupingControl1.TableDescriptor.SortedColumns[col].SortDirection == ListSortDirection.Ascending) > { > this.gridGroupingControl1.TableDescriptor.SortedColumns[col].SortDirection = ListSortDirection.Descending; > } > else > { > this.gridGroupingControl1.TableDescriptor.SortedColumns[col].SortDirection = ListSortDirection.Ascending; > } > } > else > { > this.gridGroupingControl1.TableDescriptor.SortedColumns.Add(col, ListSortDirection.Ascending); > } > } > } > >Regards, >Calvin.

Administrator [Syncfusion]
Replied On March 28, 2006 07:19 AM

Hi Kai, Thanks for the update. You can open a Direct-Trac to get details for upgrading, and it cost to upgrade from 3.X to 4.1. Regards, Calvin.

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.

;