FWorksheetSort
| packages | @univerjs/sheets-sort |
|---|
APIs
sort
Sort the worksheet by the specified column.
Signature
sort(colIndex: number, asc?: boolean = true): FWorksheetParameters
colIndex(number) — The column index to sort by.asc(boolean) — The sort order.truefor ascending,falsefor descending. The column A index is 0.
Returns
- (
FWorksheet) — The worksheet itself for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
// Sorts the worksheet by the column A in ascending order.
fWorksheet.sort(0)
// Sorts the worksheet by the column A in descending order.
fWorksheet.sort(0, false)