diff --git a/apps/spreadsheeteditor/main/app/controller/ViewTab.js b/apps/spreadsheeteditor/main/app/controller/ViewTab.js index 88febe2b4..52b79e327 100644 --- a/apps/spreadsheeteditor/main/app/controller/ViewTab.js +++ b/apps/spreadsheeteditor/main/app/controller/ViewTab.js @@ -171,7 +171,12 @@ define([ var me = this; (new SSE.Views.ViewManagerDlg({ api: this.api, - handler: function(result) { + handler: function(result, value) { + if (result == 'ok' && value) { + if (me.api) { + me.api.asc_setActiveNamedSheetView(value); + } + } Common.NotificationCenter.trigger('edit:complete', me.view); }, views: this.api.asc_getNamedSheetViews() diff --git a/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js b/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js index 92886c9ad..af713d68a 100644 --- a/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ViewManagerDlg.js @@ -89,14 +89,13 @@ define([ '', '
', '' ].join('') }, options); this.api = options.api; - this.handler = options.handler; this.views = options.views || []; this.userTooltip = true; this.currentView = undefined; @@ -261,21 +260,12 @@ define([ } } })).show(); - this.api.asc_deleteNamedSheetViews([rec.get('view')]); } }, getSettings: function() { - return this.sort; - }, - - onPrimary: function() { - return true; - }, - - onDlgBtnClick: function(event) { - this.handler && this.handler.call(this, event.currentTarget.attributes['result'].value); - this.close(); + var rec = this.viewList.getSelectedRec(); + return rec ? rec.get('name') : null; }, getUserName: function(id){ @@ -305,16 +295,11 @@ define([ } }, - hide: function () { - this.userTipHide(); - Common.UI.Window.prototype.hide.call(this); - }, - close: function () { this.userTipHide(); this.api.asc_unregisterCallback('asc_onRefreshNamedSheetViewList', this.wrapEvents.onRefreshNamedSheetViewList); - Common.UI.Window.prototype.close.call(this); + Common.Views.AdvancedSettingsWindow.prototype.close.call(this); }, onKeyDown: function (lisvView, record, e) { @@ -323,6 +308,7 @@ define([ }, onDblClickItem: function (lisvView, record, e) { + this.onPrimary(); }, txtTitle: 'Sheet View Manager',