diff --git a/apps/common/main/lib/component/ComboBoxDataView.js b/apps/common/main/lib/component/ComboBoxDataView.js index 61d8e233a4..70ecc7577c 100644 --- a/apps/common/main/lib/component/ComboBoxDataView.js +++ b/apps/common/main/lib/component/ComboBoxDataView.js @@ -156,7 +156,7 @@ define([ this.dataPicker = new Common.UI.DataView({ el: el.find('#' + id + '-data-menu'), parentMenu: menu, - outerMenu: {menu: menu, index: options.additionalItems ? options.additionalItems.length : 0}, + outerMenu: {menu: menu, index: options.additionalItems ? options.additionalItems.length : 0, focusOnShow: !options.additionalItems}, store: options.store, itemTemplate: options.itemTemplate }); @@ -187,7 +187,7 @@ define([ if (this.updateFormControl) this.updateFormControl.call(this, record); if ( this.disabled || this.isSuspendEvents) return; - this.trigger('item:click', picker, view, record); + this.trigger('item:click', this, picker, view, record); }, selectRecord: function(record) { diff --git a/apps/common/main/lib/component/DataView.js b/apps/common/main/lib/component/DataView.js index 7f63793637..a16fb2e5f0 100644 --- a/apps/common/main/lib/component/DataView.js +++ b/apps/common/main/lib/component/DataView.js @@ -381,7 +381,8 @@ define([ this.parentMenu.on('show:before', function(menu) { me.deselectAll(); }); this.parentMenu.on('show:after', function(menu, e) { if (e && (menu.el !== e.target)) return; - if (me.showLast) me.showLastSelected(); + if (me.showLast) me.showLastSelected(); + if (me.outerMenu && (me.outerMenu.focusOnShow===false)) return; Common.NotificationCenter.trigger('dataview:focus'); _.delay(function() { menu.cmpEl.find('.dataview').focus(); @@ -482,6 +483,7 @@ define([ _.each(this.store.where({selected: true}), function(record){ record.set({selected: false}); }); + this.lastSelectedRec = null; if (suspendEvents) this.resumeEvents(); @@ -1187,6 +1189,7 @@ define([ record.set({selected: false}); }); this.cmpEl.find('.item.selected').removeClass('selected'); + this.lastSelectedRec = null; if (suspendEvents) this.resumeEvents(); diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js index 4e01ecadd2..343f8c4131 100644 --- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js @@ -2045,7 +2045,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat } }, - onSelectBeginStyle: function(picker, view, record, e){ + onSelectBeginStyle: function(combo, picker, view, record, e){ if (this._changedShapeProps) { if (this._changedShapeProps.get_stroke()===null) this._changedShapeProps.put_stroke(new Asc.asc_CStroke()); @@ -2057,7 +2057,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._updateSizeArr(this.btnBeginSize, this.mnuBeginSizePicker, record, this._beginSizeIdx); }, - onSelectBeginSize: function(picker, view, record, e){ + onSelectBeginSize: function(combo, picker, view, record, e){ if (this._changedShapeProps) { if (this._changedShapeProps.get_stroke()===null) this._changedShapeProps.put_stroke(new Asc.asc_CStroke()); @@ -2067,7 +2067,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._beginSizeIdx = record.get('value'); }, - onSelectEndStyle: function(picker, view, record, e){ + onSelectEndStyle: function(combo, picker, view, record, e){ if (this._changedShapeProps) { if (this._changedShapeProps.get_stroke()===null) this._changedShapeProps.put_stroke(new Asc.asc_CStroke()); @@ -2079,7 +2079,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this._updateSizeArr(this.btnEndSize, this.mnuEndSizePicker, record, this._endSizeIdx); }, - onSelectEndSize: function(picker, view, record, e){ + onSelectEndSize: function(combo, picker, view, record, e){ if (this._changedShapeProps) { if (this._changedShapeProps.get_stroke()===null) this._changedShapeProps.put_stroke(new Asc.asc_CStroke()); diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 9e508795a6..0f97910f26 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -848,7 +848,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem } }, - onSelectBeginStyle: function(picker, view, record){ + onSelectBeginStyle: function(combo, picker, view, record){ if (this._changedProps) { if (this._changedProps.get_stroke()===null) this._changedProps.put_stroke(new Asc.asc_CStroke()); @@ -860,7 +860,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem this._updateSizeArr(this.btnBeginSize, this.mnuBeginSizePicker, record, this._beginSizeIdx); }, - onSelectBeginSize: function(picker, view, record){ + onSelectBeginSize: function(combo, picker, view, record){ if (this._changedProps) { if (this._changedProps.get_stroke()===null) this._changedProps.put_stroke(new Asc.asc_CStroke()); @@ -870,7 +870,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem this._beginSizeIdx = record.get('value'); }, - onSelectEndStyle: function(picker, view, record){ + onSelectEndStyle: function(combo, picker, view, record){ if (this._changedProps) { if (this._changedProps.get_stroke()===null) this._changedProps.put_stroke(new Asc.asc_CStroke()); @@ -882,7 +882,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem this._updateSizeArr(this.btnEndSize, this.mnuEndSizePicker, record, this._endSizeIdx); }, - onSelectEndSize: function(picker, view, record){ + onSelectEndSize: function(combo, picker, view, record){ if (this._changedProps) { if (this._changedProps.get_stroke()===null) this._changedProps.put_stroke(new Asc.asc_CStroke()); diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 9778a66547..57dd206b57 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -661,41 +661,40 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', var i = this.iconsControls.length; this.iconsControls.push({}); - var combo = new Common.UI.ComboBox({ + var combo = new Common.UI.ComboBoxDataView({ el: $('#format-rules-combo-icon-' + (i+1)), - type : i, - template: _.template([ - '
' - ].join('')) - }); - - var menu = (new Common.UI.Menu({ - style: 'min-width: 105px;', - additionalAlign: this.menuAddAlign, - items: [ - { caption: this.txtNoCellIcon, checkable: true, allowDepress: false, toggleGroup: 'no-cell-icons-' + (i+1) }, - { template: _.template('') } - ] - })).render($('#format-rules-combo-icon-' + (i+1))); - - var picker = new Common.UI.DataView({ - el: $('#format-rules-combo-menu-icon-' + (i+1)), - parentMenu: menu, - outerMenu: {menu: menu, index: 1}, - store: new Common.UI.DataViewStore(me.iconsList), + ].join('')), itemTemplate: _.template('