myliang / x-spreadsheet

The project has been migrated to @wolf-table/table https://github.com/wolf-table/table
https://myliang.github.io/x-spreadsheet
MIT License
13.98k stars 1.67k forks source link

How to programmatically switch the sheet from code #601

Closed ravinsharma7 closed 1 year ago

ravinsharma7 commented 2 years ago

When the x-spreadsheet initialize it starts from the first sheet. I want to programmatically create another sheet and switch to it. What is the API I have to use to do this?

The readme is showing how configure, set data, etc only. No information on switching sheet from the code.

hankaibo commented 1 year ago
  1. const s = new Spreadsheet("#x-spreadsheet-demo");
  2. const item = s.bottomBar.items[x]; // x is index
  3. s.bottomBar.clickSwap2(item);