Spread Windows Forms 8.0 Product Documentation
AutoSortColumn Method


Automatically sorts the rows of a sheet according to the specified column.
Automatically sorts the rows in a sheet according to the specified column with other settings depending on the overload.
Overload List
OverloadDescription
AutoSortColumn(Int32)Automatically sorts the rows of a sheet according to the specified column.  
AutoSortColumn(Int32,Boolean)Automatically sorts the rows of a sheet according to the specified column in the specified order and shows the sort indicator (unless disabled).  
AutoSortColumn(Int32,Boolean,Boolean)Automatically sorts the rows of a sheet according to the specified column in the specified order and uses the sort indicator as specified.  
Remarks

This method automatically sorts the rows in a sheet according to the specified column in ascending order unless the sheet was previously automatically sorted ascending. This also shows the sort indicator unless the sort indicator for the column has been disabled with a call to the SetColumnShowSortIndicator method or the Column.ShowSortIndicator property. The SetColumnShowSortIndicator method must be called before the AutoSortColumn method. Otherwise, the sort indicator is shown and remains displayed.

This method performs the same action as clicking in the column header of the specified column that has its SetColumnAllowAutoSort property set to true. (The SetColumnAllowAutoSort property does not need to be set to true to use this method.) . If this method is called successively with the same column index, then the direction of the sort is reversed. If the method is called with a different column index, then the previously sorted column's sort indicator is changed back to SortIndicator.None (if there is one) and the specified column is used as the key column in a call to SortRows to sort all the rows in the sheet by that column.

This does not affect the data model, only how the data is displayed. Different overloads provide different ways to sort the rows in a sheet.

This method calls the SortRows method, which turns on the sort indicator for the key column specified and only in the overloads that take the showIndicator argument. SortRows does not change the sort indicator back again on successive calls. This must be done manually by the developer with the SheetView.SetColumnShowSortIndicator method or the Column.ShowSortIndicator property.

To manually sort rows by more than one column (by more than one sort key), use the SortRows methods.

If you want to change the sort indicator shown for a column, use the SheetView.SetColumnSortIndicator method or the Column.SortIndicator property. These change the sort indicator in the column header and do not affect whether the column is sorted or not.

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

Reference

SheetView Class
SheetView Members
SetColumnAllowAutoSort Method
SortColumns Method
SortRows Method
SortRange Method

User-Task Documentation

Managing Sorting

 

 


Copyright © GrapeCity, inc. All rights reserved.