Sorting
This section covers the methods to handle the table sorting
Documentation
Section titled “Documentation”Methods
Section titled “Methods”| Method | Description |
|---|---|
| orderBy | Sorts the rows of a worksheet based on the values in a column. @param columnNumber - Column that will decide the new order.@param direction - The direction of ordination. false is equivalent to ascending sorting and true is equivalent to descending sorting. Jworksheet orderBy(columnNumber: number, direction: boolean): Promise<void> POST /api/:guid/:worksheetIndex/order |
Examples
Section titled “Examples”Sorting the data in a column
Section titled “Sorting the data in a column”import { Client } 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);
// Get Jworksheet objectconst worksheet = spreadsheet.getWorksheet(0);
// Sort columnworksheet.orderBy(2, false).then(() => { // It worked correctly});curl -X POST "http://localhost:8009/api/15eb1171-5a64-45bf-be96-f52b6125a045/0/order" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \ -H "Content-Type: application/json" \ -d '{ "column": 2, "direction": false }'