diff --git a/Toolkit.js b/Toolkit.js index d837890..c30aae1 100644 --- a/Toolkit.js +++ b/Toolkit.js @@ -333,7 +333,36 @@ Ext.define('Proxmox.form.ComboBox', { me.clearValue(); me.setValue(me.originalValue); } - } + }, + + // we also want to open the trigger on editable comboboxes by default + initComponent: function() { + let me = this; + me.callParent(); + + if (me.editable) { + // The trigger.picker causes first a focus event on the field then + // toggles the selection picker. Thus skip expanding in this case, + // else our focus listener expands and the picker.trigger then + // collapses it directly afterwards. + Ext.override(me.triggers.picker, { + onMouseDown: function(e) { + // copied "should we focus" check from Ext.form.trigger.Trigger + if (e.pointerType !== 'touch' && !this.field.owns(Ext.Element.getActiveElement())) { + me.skip_expand_on_focus = true; + } + this.callParent(arguments); + } + }); + + me.on("focus", function(combobox) { + if (!combobox.isExpanded && !combobox.skip_expand_on_focus) { + combobox.expand(); + } + combobox.skip_expand_on_focus = false; + }); + } + }, }); // when refreshing a grid/tree view, restoring the focus moves the view back to diff --git a/form/ComboGrid.js b/form/ComboGrid.js index 9bdf721..5bea0d0 100644 --- a/form/ComboGrid.js +++ b/form/ComboGrid.js @@ -404,29 +404,6 @@ Ext.define('Proxmox.form.ComboGrid', { me.createPicker(); } - if (me.editable) { - // The trigger.picker causes first a focus event on the field then - // toggles the selection picker. Thus skip expanding in this case, - // else our focus listner expands and the picker.trigger then - // collapses it directly afterwards. - Ext.override(me.triggers.picker, { - onMouseDown : function (e) { - // copied "should we focus" check from Ext.form.trigger.Trigger - if (e.pointerType !== 'touch' && !this.field.owns(Ext.Element.getActiveElement())) { - me.skip_expand_on_focus = true; - } - this.callParent(arguments); - } - }); - - me.on("focus", function(me) { - if (!me.isExpanded && !me.skip_expand_on_focus) { - me.expand(); - } - me.skip_expand_on_focus = false; - }); - } - me.mon(me.store, 'beforeload', function() { if (!me.isDisabled()) { me.enableLoadMask = true;