SpreadJS Documentation
sortRange Method
GC.Spread.Sheets Namespace > Worksheet type : sortRange Method
The index of the starting row of the block of cells to sort.
The index of the starting column of the block of cells to sort.
The number of rows in the block of cells.
The number of columns in the block of cells.
Set to true to sort by rows, and false to sort by columns.

The following settings are available:

sortInfo.index number type The index of the column or row on which to sort.
sortInfo.ascending boolean type Whether the sort order is ascending.
Sorts a range of cells in this sheet in the data model.
Syntax
var instance = new GC.Spread.Sheets.Worksheet(name);
var value; // Type: boolean
value = instance.sortRange(row, column, rowCount, columnCount, byRows, sortInfo);
function sortRange( 
   row : number,
   column : number,
   rowCount : number,
   columnCount : number,
   byRows : boolean,
   sortInfo : Object
) : boolean;

Parameters

row
The index of the starting row of the block of cells to sort.
column
The index of the starting column of the block of cells to sort.
rowCount
The number of rows in the block of cells.
columnCount
The number of columns in the block of cells.
byRows
Set to true to sort by rows, and false to sort by columns.
sortInfo

The following settings are available:

sortInfo.index number type The index of the column or row on which to sort.
sortInfo.ascending boolean type Whether the sort order is ascending.

Return Value

true if the data is sorted successfully; otherwise, false.
Example
This example sorts a range.
sheet.setValue(0,0,"112");
sheet.setValue(1,0,"10");
sheet.setValue(2,0,"223");
sheet.setValue(3,0,"20");
sheet.setValue(4,0,"334");
sheet.setValue(5,0,"30");
sheet.sortRange(0, 0, 6, 1, true, [
                {index:0, ascending:true}
                ]);
See Also

Reference

Worksheet type
Sorting Data