New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Worksheet helpers and name to id translation #32
Comments
We should go further with this API. If we're going to implement full spreadsheet based on HyperFormula then we will need access to more for the UI: public getSheetCount(): number; // returns the count of worksheets in a workbook.
public doesSheetExists(sheet: number): boolean; // tests whether a worksheet exists.
public getSheetIndex(sheet: string): number; // returns the Index number (position) of a worksheet.
public getSheetName(sheet: number): string; // returns the name of a worksheet.
public getSheetNames(): string[]; // returns a list of all worksheets in a workbook. |
I know that you don't have full sheets support yet, but only a spike, but maybe can you elaborate in which cases do you need to know the sheet name, except of displaying it to the user in the "tabs" below the spreadsheet? Just to have better perspective, I pretty much agree that most of these functions sound useful. |
Sure, no problem. Any reference to sheets will by onModifyData(row, col, newValue) {
return engine.getCellValue({ row, col, sheet: engine.getSheetID(this.sheetName) }
} (simplified example from handsontable/handsontable#6466) We don't have the support multiple worksheets fully right now. With the helpers, it will be easly doable by the end-developer. From the end-user or developer perspective we're going to reference sheets mostly by name. Multiple worksheets will be supported by adding an <div class="handsontable" id="sheet1"></div> And then somewhere lower another one: <div class="handsontable" id="sheet2"></div> Inside the plugin, we will take the private initializeThePlugin() {
if (!privatePool.hyperformula) {
privatePool.hyperformula = new HyperFormula(this.config);
}
const sheetName = this.instance.getSettings().id;
if (privatePool.hyperformula.isItPossibleToAddSheet(sheetName)) {
privatePool.hyperformula.addSheet(sheetName);
}
} Other methods we will expose to the end developer in our public API. It's up to her to implement the tabs in UI. We don't have to have this functionality in Handsontable. Our clients will appreciate that they have everything that is needed to do it on their own. And IMO this is the preferred approach (at this moment) since everyone has different needs when it comes to the UI. With |
Focus is on name translation: public getSheetID(sheetName: string): number;
public getSheetName(sheetID: number): string; We can split the rest into a separate task if they are more time-consuming. Looks like its already is #12 |
👍
Setting the language for the worksheet. But I see now that the language is set once at the workbook level and inherited by worksheets.
👍 |
We have noticed that |
Extracted to #66 |
Done in issue #78 :) |
Description
Mainly our API operates on worksheet numerical ID. Which is OK, but as a developer in Handsontable we have reference to the sheet kept and used mostly as a string name. To integrate those two worlds we will need to read Hyperformula name to id mapping.
The best option here is to add name translation methods:
API proposal
The text was updated successfully, but these errors were encountered: