[pve-devel] applied: [PATCH widget-toolkit v4 10/18] combogrid: add 'showClearTrigger' config

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Feb 28 11:41:49 CET 2024


Am 28/02/2024 um 11:00 schrieb Lukas Wagner:
> 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(-)
> 
>

applied, thanks! 

I made a follow up though to clarify that the showClearTrigger cannot be
used to hide it, and to simplify the boolean expression.

diff --git a/src/form/ComboGrid.js b/src/form/ComboGrid.js
index 3aaa717..cca92b1 100644
--- a/src/form/ComboGrid.js
+++ b/src/form/ComboGrid.js
@@ -32,6 +32,8 @@ Ext.define('Proxmox.form.ComboGrid', {
        notFoundIsValid: false,
        deleteEmpty: false,
        errorHeight: 100,
+       // NOTE: the trigger will always be shown if allowBlank is true, setting showClearTrigger
+       // to false cannot change that
        showClearTrigger: false,
     },
 
@@ -55,10 +57,7 @@ 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) ||
-           (!empty && me.showClearTrigger),
-       );
+       me.triggers.clear.setVisible(!empty && (me.allowBlank || me.showClearTrigger));
        return me.callParent([value]);
     },




More information about the pve-devel mailing list