diff --git a/css/Makefile b/css/Makefile index 36e62ff..5054b55 100644 --- a/css/Makefile +++ b/css/Makefile @@ -1,6 +1,6 @@ include ../defines.mk -CSS= +CSS=ext6-pmx.css all: diff --git a/css/ext6-pmx.css b/css/ext6-pmx.css new file mode 100644 index 0000000..898c5bc --- /dev/null +++ b/css/ext6-pmx.css @@ -0,0 +1,3 @@ +.pmx-clear-trigger { + background-image: url(../images/pmx-clear-trigger.png); +} diff --git a/form/ComboGrid.js b/form/ComboGrid.js index 608f613..aaaa107 100644 --- a/form/ComboGrid.js +++ b/form/ComboGrid.js @@ -38,6 +38,24 @@ Ext.define('Proxmox.form.ComboGrid', { editable: false, + triggers: { + clear: { + cls: 'pmx-clear-trigger', + weight: -1, + hidden: true, + handler: function() { + var me = this; + me.setValue(''); + } + } + }, + + setValue: function(value) { + var me = this; + me.triggers.clear.setVisible(!!value && me.allowBlank); + return me.callParent([value]); + }, + // override ExtJS method // if the field has multiSelect enabled, the store is not loaded, and // the displayfield == valuefield, it saves the rawvalue as an array diff --git a/images/Makefile b/images/Makefile index 002ad27..45bc50a 100644 --- a/images/Makefile +++ b/images/Makefile @@ -1,6 +1,6 @@ include ../defines.mk -IMAGES= +IMAGES=pmx-clear-trigger.png all: diff --git a/images/pmx-clear-trigger.png b/images/pmx-clear-trigger.png new file mode 100644 index 0000000..cc374cf Binary files /dev/null and b/images/pmx-clear-trigger.png differ