diff --git a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js index 4d06df571..af5a1c710 100644 --- a/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js +++ b/apps/spreadsheeteditor/main/app/controller/FormulaDialog.js @@ -411,13 +411,22 @@ define([ } }, - onWatch: function() { - (new SSE.Views.WatchDialog({ - api: this.api, - handler: function(result) { - Common.NotificationCenter.trigger('edit:complete'); - }, - })).show(); + onWatch: function(state) { + if (state) { + var me = this; + this._watchDlg = new SSE.Views.WatchDialog({ + api: this.api, + handler: function(result) { + Common.NotificationCenter.trigger('edit:complete'); + } + }); + this._watchDlg.on('close', function(win){ + me.formulaTab.btnWatch.toggle(false, true); + me._watchDlg = null; + }).show(); + } else if (this._watchDlg) + this._watchDlg.close(); + }, sCategoryAll: 'All', diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index b13fd8c2c..9225588a1 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -69,8 +69,8 @@ define([ me.btnNamedRange.menu.on('item:click', function (menu, item, e) { me.fireEvent('function:namedrange', [menu, item, e]); }); - me.btnWatch.on('click', function(){ - me.fireEvent('function:watch'); + me.btnWatch.on('click', function(b, e){ + me.fireEvent('function:watch', [b.pressed]); }); } return { @@ -328,7 +328,8 @@ define([ caption: this.txtWatch, hint: this.tipWatch, disabled: true, - lock: [_set.editText, _set.lostConnect, _set.coAuth], + enableToggle: true, + lock: [_set.editCell, _set.lostConnect, _set.coAuth], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small' diff --git a/apps/spreadsheeteditor/main/app/view/WatchDialog.js b/apps/spreadsheeteditor/main/app/view/WatchDialog.js index 6ff13dae1..2424bc9a4 100644 --- a/apps/spreadsheeteditor/main/app/view/WatchDialog.js +++ b/apps/spreadsheeteditor/main/app/view/WatchDialog.js @@ -53,6 +53,7 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', alias: 'WatchDialog', contentWidth: 560, height: 294, + modal: false, buttons: null }, @@ -148,9 +149,8 @@ define([ 'text!spreadsheeteditor/main/app/template/WatchDialog.template', props: watch }); } - this.watchList.store.reset(arr); } - + this.watchList.store.reset(arr); this.updateButtons(); },