From 36d167d6298ad5e2333561e5c5e00b214fc0cd97 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 28 Feb 2024 11:34:42 +0100 Subject: [PATCH] form: combo grid: clarify that showClearTrigger cannot actively hide them As getting a good setting name is a bit hard here, the current one might me interpreted such that setting it to false will always hide the trigger, but that's not the case, this is mostly a "force show trigger even if allowBlank is set to false", and that's a bit of a long name ;-) So just add a comment and reevaluate if this really causes confusion. While at it simplify the boolean expression to make it shorter and easier to read. Signed-off-by: Thomas Lamprecht --- src/form/ComboGrid.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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]); },