FlexGrid for WinForms
Sort(SortFlags,Int32) Method



SortFlags value that specifies the sort direction and options.
Column to sort on.
Sorts the grid contents based on a column.
Syntax
'Declaration
 
Public Overloads Overridable Sub Sort( _
   ByVal order As SortFlags, _
   ByVal col As Integer _
) 
'Usage
 
Dim instance As C1FlexGridBase
Dim order As SortFlags
Dim col As Integer
 
instance.Sort(order, col)
public virtual void Sort( 
   SortFlags order,
   int col
)
public:
virtual void Sort( 
   SortFlags order,
   int col
) 

Parameters

order
SortFlags value that specifies the sort direction and options.
col
Column to sort on.
Remarks

Sorting works differently depending on whether the grid is bound to a data source or not.

In bound mode, the grid passes the sort request to the underlying data source object. In this case, the sort settings remain in effect as the grid data changes. Editing values in the sort column will cause the data source to re-sort the data, and grid will show the changes automatically. This is equivalent to setting the System.Data.DataView.Sort property on a System.Data.DataView object for example.

In unbound mode, the Sort method sorts the data that is currently stored in the grid. Changing the data after it has been sorted will not automatically update the sort.

When the grid is bound to a new data source, it inherits the sort settings currently applied to the new data source object. Because of this, calling Sort immediately before setting the DataSource property has no effect on the grid.

In unbound mode, the grid uses a stable sorting algorithm. This means that the sorting keeps the relative order of records when the sorting key is the same. For example, if you sort a list of files by name, then by extension, the list will still be sorted by name within each extension group.

The grid recognizes two types of row: regular rows which contain data, and node rows which are used to group data. The Sort method only sorts regular rows; it does not affect node rows at all. To sort nodes, use the GridTree.Sort method in the Tree property or the Node.Sort method in the Node class.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

C1FlexGridBase Class
C1FlexGridBase Members
Overload List

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Send Feedback