diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index e215f313e..84e898f9a 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -272,7 +272,7 @@ define([ setApi: function(api) { this.api = api; - this.api.asc_registerCallback('asc_onInitTablePictures', _.bind(this.onApiInitTableTemplates, this)); + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this, true)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); @@ -1366,14 +1366,21 @@ define([ }, onTableTplMenuOpen: function(cmp) { - var scroller = this.toolbar.mnuTableTemplatePicker.scroller; + this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo())); + var scroller = this.toolbar.mnuTableTemplatePicker.scroller; if (scroller) { scroller.update({alwaysVisibleY: true}); scroller.scrollTop(0); } }, + onSendThemeColors: function() { + // get new table templates + if (this.toolbar.btnTableTemplate.rendered && this.toolbar.btnTableTemplate.cmpEl.hasClass('open')) + this.onTableTplMenuOpen(); + }, + onApiInitTableTemplates: function(images) { var store = this.getCollection('TableTemplates'); if (store) { diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index 99192676a..355b471d0 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -140,7 +140,7 @@ define([ setApi: function(o) { this.api = o; if (o) { - this.api.asc_registerCallback('asc_onInitTablePictures', _.bind(this.onApiInitTableTemplates, this)); + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); } return this; }, @@ -347,6 +347,14 @@ define([ } }, + onSendThemeColors: function() { + // get new table templates + if (this.cmbTableTemplate) { + this.onApiInitTableTemplates(this.api.asc_getTablePictures(this._originalProps)); + this.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY: true}); + } + }, + onApiInitTableTemplates: function(Templates){ var self = this; this._isTemplatesChanged = true;