mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-05-03 01:04:30 +00:00
ComboGrid: correctly set/mark multiSelect fields
in fields with 'multiSelect: true', we get an array as value instead of a string, but a check of !![] results in true (since an array is an object), so we have to explicitely check for arraylength in 'setValue' (for correctly showing the trigger) and in the load handler (to not set an empty field wrongfully to invalid) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
013cbd6425
commit
f32aa3df74
@ -52,7 +52,8 @@ Ext.define('Proxmox.form.ComboGrid', {
|
||||
|
||||
setValue: function(value) {
|
||||
var me = this;
|
||||
me.triggers.clear.setVisible(!!value && me.allowBlank);
|
||||
let empty = Ext.isArray(value) ? !value.length : !value;
|
||||
me.triggers.clear.setVisible(!empty && me.allowBlank);
|
||||
return me.callParent([value]);
|
||||
},
|
||||
|
||||
@ -458,7 +459,7 @@ Ext.define('Proxmox.form.ComboGrid', {
|
||||
if (me.autoSelect && rec && rec.data) {
|
||||
def = rec.data[me.valueField];
|
||||
me.setValue(def, true);
|
||||
} else {
|
||||
} else if (!me.allowBlank && ((Ext.isArray(def) && def.length) || def)) {
|
||||
me.setValue(def);
|
||||
if (!me.notFoundIsValid) {
|
||||
me.markInvalid(gettext('Invalid Value'));
|
||||
|
Loading…
Reference in New Issue
Block a user