Sorting
This section covers the methods to handle the table sorting
Documentation
Section titled “Documentation”Methods
Section titled “Methods”| Method | Description |
|---|---|
| orderBy | Sorting the data by a column. @param column - column number. @param direction - sorting direction. Default is descending. Jspreadsheet orderBy(column: number, direction?: orderByDirection): Promise<void> POST /api/:guid/orderby |
Examples
Section titled “Examples”Sorting the data in a column
Section titled “Sorting the data in a column”import { Client, orderByDirection } from "@intrasheets/client";
// Create a new clientconst client = new Client({ // API Server baseUrl: "http://localhost:8009/api", // Your authentication token token: "eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i",});
// Spreadsheet Guidconst guid = '15eb1171-5a64-45bf-be96-f52b6125a045';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// orderByDirection.Asc = Ascending order// orderByDirection.Desc = Descending order
// Sort columnspreadsheet.orderBy(2, orderByDirection.Asc).then(() => { // It worked correctly}).catch((err) => { // Something went wrong console.log(err);});