]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
combogrid: initialze value with [] by default
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 19 Jul 2023 12:11:09 +0000 (14:11 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 14 Nov 2023 08:03:59 +0000 (09:03 +0100)
we have to initialize the value of a combogrid to something (else extjs
does not initialize everything in the object *sometimes* for yet unknown
reasons), but the empty string is wrong.

we already have at least two places where we set the default value to []
(namely NodeSelector and ha GroupSelector) with the comment:

 // set default value to empty array, else it inits it with
 // null and after the store load it is an empty array,
 // triggering dirtychange

so it makes sense to always set it to that by default. This only ever is
relevant when the combogrid has `allowBlank: true`, since if it does not
it's either invalid (and thus "dirty") or it has a selected value anyway

this should make the manual setting of

 value: [],

unnecessary in the child classes. We can even remove it direcly in the
NetworkSelector.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/form/ComboGrid.js
src/form/NetworkSelector.js

index 55dee7ed2e3893e2f0cd6ea451638327858c8c43..6338a3adb985a6f389371f702affc0f46cf74ebb 100644 (file)
@@ -400,7 +400,7 @@ Ext.define('Proxmox.form.ComboGrid', {
            matchFieldWidth: false,
        });
 
-       Ext.applyIf(me, { value: '' }); // hack: avoid ExtJS validate() bug
+       Ext.applyIf(me, { value: [] }); // hack: avoid ExtJS validate() bug
 
        Ext.applyIf(me.listConfig, { width: 400 });
 
index ed3a02b8bf23e288fb15c67806d6093d637d284b..caa7b7ed9febf9b09b69011feed8bcc9c864dc0a 100644 (file)
@@ -45,10 +45,6 @@ Ext.define('Proxmox.form.NetworkSelector', {
            networkSelectorStore.load();
        }
     },
-    // set default value to empty array, else it inits it with
-    // null and after the store load it is an empty array,
-    // triggering dirtychange
-    value: [],
     valueField: 'cidr',
     displayField: 'cidr',
     store: {