setActive()
Description
Switches the active (visible) sheet to the one specified by its identifier
The spreadsheet UI will re-render to display the target sheet's contents.
Usage
setActive: (id: Id) => void;
Parameters
id- (string | number) required, the unique identifier of the sheet to activate.
Example
const spreadsheet = new dhx.Spreadsheet("spreadsheet_container", {
multiSheets: true
});
spreadsheet.parse(data);
// Switch to the second sheet
spreadsheet.sheets.setActive("sheet_2");
// Verify the switch
const active = spreadsheet.sheets.getActive();
console.log(active.name); // "Sheet 2"
Change log: Added in v6.0
Related articles: Working with sheets