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?
AD
Administrator
Syncfusion Team
March 24, 2006 07:11 AM UTC
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.
KA
Kai
March 24, 2006 09:03 AM UTC
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.
KA
Kai
March 24, 2006 09:23 AM UTC
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.
AD
Administrator
Syncfusion Team
March 24, 2006 10:13 AM UTC
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.
KA
Kai
March 27, 2006 02:19 AM UTC
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.
AD
Administrator
Syncfusion Team
March 27, 2006 03:40 PM UTC
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.
KA
Kai
March 28, 2006 05:59 AM UTC
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.
AD
Administrator
Syncfusion Team
March 28, 2006 12:19 PM UTC
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.