[pve-devel] [PATCH v2 proxmox-widget-toolkit 15/22] combogrid: add 'showClearTrigger' config

Lukas Wagner l.wagner at proxmox.com
Wed Dec 13 17:37:54 CET 2023


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 <l.wagner at proxmox.com>
---
 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]);
     },
 
-- 
2.39.2





More information about the pve-devel mailing list