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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

complex sorting

Thread ID:

Created:

Updated:

Platform:

Replies:

2881 Feb 18,2003 04:08 PM UTC Feb 24,2003 09:58 PM UTC WinForms 7
loading
Tags: GridControl
Brian Severa
Asked On February 18, 2003 04:08 PM UTC

Is there a way to do a complex sort by clicking on ONE column header. As an example: I have 4 columns in my grid and I click on the fourth column header. I want the grid to sort by column 4 (primary), column 1 and column 2. If I click on column 3 header I want the grid to sort by column 3, column 1, column 2. Brian

Administrator [Syncfusion]
Replied On February 18, 2003 09:18 PM UTC

Multicolumn sorting is not currently directly supported in Essential Grid. We will improve the sorting support in a future release. It would be possible to do such sorting on the underlying datasource. One simple example would be if the grid's datasource is a datatable. Then you could set the Sort property on the DataTable.DefaultView. This Sort property handles multiple columns.

Ivan Pelly
Replied On February 19, 2003 03:39 PM UTC

Along the same lines, what would be the best way to 1) disable the default "double-click to sort" behavior, and 2) place my own graphic in the header, in the same way that the built-in sort capability does? Thanks!

Administrator [Syncfusion]
Replied On February 19, 2003 11:07 PM UTC

You can turn off the default sorting using the GridDataBoundGrid.SortBehavior property. To do your own sorting and get the sort header, you can look at the Grid\Samples\In Depth\GridControlSort sample. It shows one way to do the sort headers.

Ivan Pelly
Replied On February 24, 2003 01:48 PM UTC

I found an example in \Grid\Samples\Quick Start\GridControlSort\VB, but it wasn't obvious how the up/down graphic in the header was being created. What's the recommended way to draw my own graphic in the header? Thanks!

Administrator [Syncfusion]
Replied On February 24, 2003 03:35 PM UTC

Sorry about the wrong folder. The sore header is being drawn by the ColumnHeaderCell celltype. That is why the code keeps switching the celltype from Header to ColumnHeaderCell. If you want to draw your own sort header, probably the simplest way is to use the AferDrawCell event, and then draw whatever you want there using the event arguments which include the bounds, the Graphics object, etc. Now, this event requires that you have 1.5.1.6 wheich is available for download from your support homepage. Here is a snippet that you can add to the GridControlSort sample that will just display the sort headers red and blue. You would want to draw your bitmap or whatever....
Private Sub gridControl1_AfterDrawCell(sender As Object, e As Syncfusion.Windows.Forms.Grid.GridDrawCellEventArgs)
   If e.ColIndex > 0 And e.RowIndex = 0 Then
      If Me.gridControl1(0, e.ColIndex).CellType = "ColumnHeaderCell" Then
         If CType(Me.gridControl1(0, e.ColIndex).Tag, ListSortDirection) = ListSortDirection.Ascending Then
            e.Graphics.FillRectangle(Brushes.Blue, e.Bounds)
         Else
            e.Graphics.FillRectangle(Brushes.Red, e.Bounds)
         End If
      End If
   End If
End Sub 'gridControl1_AfterDrawCell    

Ivan Pelly
Replied On February 24, 2003 06:49 PM UTC

Thanks! Does the column type have to be ColumnHeaderCell for this to work?

Administrator [Syncfusion]
Replied On February 24, 2003 09:58 PM UTC

Not necessarily. But somehow you must determine whether the column header being drawn is the particular column that needs to have the sort header. In the GridControlSort sample, testing for ColumnHeaderCell is how to do this.

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.

Warning Icon 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.Close Icon

;