Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Expand]Grid View
   [Expand]View Technology
   [Expand]Grouping
   [Collapse]Sorting
     Sorting Overview
     Sortable and Non-Sortable Columns
     Tutorial: Custom Sorting and Non-Sortable Columns
     Tutorial: Data Sorting Basics
     Tutorial: Sorting by Values or Display Text
   [Expand]Summaries
   [Expand]Data Editing
   [Expand]Filtering and Locating Rows
   [Expand]Focus and Selection Handling
   [Expand]Processing Rows
   [Expand]Formatting Cell Values
   [Expand]Master-Detail Relationships
   [Expand]Asynchronous Image Load
   [Expand]Export and Printing
   [Expand]Appearance and Conditional Formatting
   [Expand]Batch Modifications
   [Expand]Hit Information
   [Expand]Hints
   [Expand]Popup Menus
   [Expand]Saving and Restoring Layouts
   [Expand]Visual Elements
   [Expand]Design-Time Features
   [Expand]Examples
   [Expand]End-User Capabilities
    Included Components
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Sortable and Non-Sortable Columns

The Grid Control permits data to be sorted against specific columns according to the type of data and the type of in-place editors used within the columns. This topic provides more information on this.

Expanded Sortable and Non-Sortable Columns

By default, grid columns that contain text or numeric data can be sorted and grouped. Columns that represent any binary data (graphics) or custom data cannot be sorted/grouped.

If you need to enable sorting/grouping for columns that display custom data, you can implement the System.IComparable interface for the column's object. See MSDN for examples of implementing this interface.

By default, columns that use MemoExEdit, ImageEdit and PictureEdit in-place editors cannot be sorted in the GridControl. If a column uses a MemoExEdit control for in-place editing, you can enable data sorting by setting the column's OptionsColumn.AllowSort property to True. In this instance, rows will be sorted by the strings that are displayed within the dropdowns of in-place editors. If you need to implement a custom sorting algorithm, set the GridColumn.SortMode property to Custom and handle the ColumnView.CustomColumnSort event.

For columns that use ImageEdit and PictureEdit in-place editors you can enable data sorting by setting the column's OptionsColumn.AllowSort property to True, setting the GridColumn.SortMode property to Custom and implementing the sorting algorithm with the ColumnView.CustomColumnSort event.

To enable data grouping for columns that use MemoExEdit, ImageEdit and PictureEdit in-place editors set the OptionsColumn.AllowGroup property to True. The GridView.CustomColumnGroup event can be handled to group data using custom rules (ensure that the GridColumn.SortMode property is set to Custom). If this event is not handled the rows will be grouped according to the comparison results of the ColumnView.CustomColumnSort event.

To prevent data sorting/grouping for specific columns use the OptionsColumn.AllowSort and OptionsColumn.AllowGroup properties. You can also disable sorting and grouping for all columns in a View using the GridOptionsCustomization.AllowSort and GridOptionsCustomization.AllowGroup properties.

Expanded See Also

How would you rate this topic?​​​​​​​