I have a sheetnode module enabled. On some of the pages, it is used in the "HTML table" mode in the right pane, and on some other pages there is a full-blown editable spreadsheet.
All pages that use the spreadsheet as an HTML table have this error in JavaScript Console in Firefox:
TypeError: editor.griddiv is undefined
This comes from SocialCalc.CalculateEditorPositions().
I have traced it to the fact that Drupal.sheetnode.prototype.start() omits the initialization of spreadsheet control or the viewer if the view mode is "HTML table" and saving the element is disabled:
if (self.settings.saveElement || self.settings.viewMode != Drupal.sheetnode.viewModes.htmlTable) {
if (showEditor) {
this.spreadsheet.InitializeSpreadsheetControl(this.settings.containerElement, 700, this.$container.width());
}
else {
this.spreadsheet.InitializeSpreadsheetViewer(this.settings.containerElement, 700, this.$container.width());
}
if (parts && parts.edit) {
this.spreadsheet.editor.LoadEditorSettings(this.settings.value.substring(parts.edit.start, parts.edit.end));
}
}
The problem is that later in the setup function, this is called:
this.spreadsheet.editor.EditorScheduleSheetCommands('recalc');
And this (through a long chain of function calls and timers) wants to recalculate new cell sizes, and apply them to griddiv.
I have worked around the problem by always initializing the spreadsheet viewer:
if (true || self.settings.saveElement || self.settings.viewMode != Drupal.sheetnode.viewModes.htmlTable) {
// ...
}
but would like to see a proper fix.
Comments