diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 3a4613f43..604b23a32 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -970,12 +970,13 @@ define([ onApiAutofilter: function(config) { var me = this; - if (me.permissions.isEdit) { - var dlgFilter = new SSE.Views.AutoFilterDialog({api: this.api}).on({ + if (me.permissions.isEdit && !me.dlgFilter) { + me.dlgFilter = new SSE.Views.AutoFilterDialog({api: this.api}).on({ 'close': function () { if (me.api) { me.api.asc_enableKeyEvents(true); } + me.dlgFilter = undefined; } }); @@ -984,8 +985,11 @@ define([ } Common.UI.Menu.Manager.hideAll(); - dlgFilter.setSettings(config); - dlgFilter.show(); + me.dlgFilter.setSettings(config); + var offset = me.documentHolder.cmpEl.offset(), + x = config.asc_getCellPosX() + offset.left, + y = config.asc_getCellPosY() + offset.top; + me.dlgFilter.show(x, y); } }, diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index 303d7fbed..52a215cdc 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -472,17 +472,19 @@ define([ _.extend(_options, { width : 423, - height : 301, + height : 265, contentWidth : 400, - header : true, + header : false, cls : 'filter-dlg', contentTemplate : '', title : t.txtTitle, + modal : false, + animate : false, items : [] }, options); this.template = options.template || [ - '
', + '
', '
', '
', '', @@ -770,10 +772,21 @@ define([ this.setupDataCells(); this._setDefaults(); + + var checkDocumentClick = function(e) { + if ($(e.target).closest('.filter-dlg').length<=0) + me.close(); + }; + this.on('close',function() { + $(document.body).off('mousedown', checkDocumentClick); + }); + _.delay(function () { + $(document.body).on('mousedown', checkDocumentClick); + }, 100, this); }, - show: function () { - Common.UI.Window.prototype.show.call(this); + show: function (x, y) { + Common.UI.Window.prototype.show.call(this, x, y); var me = this; if (this.input) {