From 4bee6fb07453f1395d14dc14e17fa6c985a4808f Mon Sep 17 00:00:00 2001 From: Lukas Wagner Date: Wed, 28 Feb 2024 11:00:58 +0100 Subject: [PATCH] combogrid: add 'showClearTrigger' config This allows one configure the clear trigger to be shown, even if 'allowBlank' is set false. This can be useful if one has a non-editable combogrid where the value is set to something not present in the store. Example: Match rule editing, one selects a backup job to be match. If the backup job is removed and the match rule edit window is opened again, then the old, deleted value cannot be removed from the combogrid if there is no clear trigger. Signed-off-by: Lukas Wagner Signed-off-by: Thomas Lamprecht --- src/form/ComboGrid.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/form/ComboGrid.js b/src/form/ComboGrid.js index 6338a3a..3aaa717 100644 --- a/src/form/ComboGrid.js +++ b/src/form/ComboGrid.js @@ -32,6 +32,7 @@ Ext.define('Proxmox.form.ComboGrid', { notFoundIsValid: false, deleteEmpty: false, errorHeight: 100, + showClearTrigger: false, }, // needed to trigger onKeyUp etc. @@ -54,7 +55,10 @@ Ext.define('Proxmox.form.ComboGrid', { setValue: function(value) { let me = this; let empty = Ext.isArray(value) ? !value.length : !value; - me.triggers.clear.setVisible(!empty && me.allowBlank); + me.triggers.clear.setVisible( + (!empty && me.allowBlank) || + (!empty && me.showClearTrigger), + ); return me.callParent([value]); },