Group columns
Manage the column groups of your online spreadsheets using the following methods.
Documentation
Section titled “Documentation”Methods
Section titled “Methods”Available methods for column groups management.
| Method | Description |
|---|---|
| setColumnGroup | Set a group of columns. @param column - index of the first column of the group. @param numOfItems - number of columns in the group. @param state - group state (open or closed). Jworksheet setColumnGroup(column: number, numOfItems: number, state?: boolean): Promise<void> POST /api/:guid/:worksheetIndex/group/columns |
| resetColumnGroup | Undo a group of columns. @param column - index of the first column of the group. Jworksheet resetColumnGroup(column: number): Promise<void> POST /api/:guid/:worksheetIndex/group/columns |
Examples
Section titled “Examples”Set column group
Section titled “Set column group”Add a group of columns from the second column to the fourth.
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 = '79b45919-c751-4e2b-a49a-6c1286e2fc03';
// Get the spreadsheet instanceconst spreadsheet = client.getSpreadsheet(guid);
// Get Jworksheet objectconst worksheet = spreadsheet.getWorksheet(0);
// Set column groupworksheet .setColumnGroup(1, 2) .then(() => { // It worked correctly }) .catch((err) => { console.log(err); });curl -X POST "http://localhost:8009/api/79b45919-c751-4e2b-a49a-6c1286e2fc03/0/group/columns" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCJ9.eyJkb21haW4iOiJsb2NhbGhvc3Q6ODAPQSJ9.Xr2Ir2-zEc_tqV5y6i" \ -H "Content-Type: application/json" \ -d '{ "column": 1, "numOfItems": 2, "state": "open" }'