Recheck field validation after manually enabling the input field of a ComboGrid

Calling setDisabled(true) on a component makes it valid, but calling setDisabled(false) afterwards did not retrigger a validation check

This fixes a serious bug which was happening in the following
conditions, for instance in the template tab of LXC Wizard:
1) user selects a storage
2) this triggers a reload of a related combogrid
3) this combogrid is marked valid, although its value is empty and it had allowedBlank: false
This commit is contained in:
Emmanuel Kasper 2016-04-11 14:35:58 +02:00 committed by Dietmar Maurer
parent c5216dfc36
commit a9648afabe

View File

@ -242,6 +242,8 @@ Ext.define('PVE.form.ComboGrid', {
me.mon(me.store, 'beforeload', function() {
if (!me.isDisabled()) {
// prevent user input and field validation until the store is successfully loaded
me.suspendEvent('validitychange');
me.setDisabled(true);
me.enableAfterLoad = true;
}
@ -255,6 +257,8 @@ Ext.define('PVE.form.ComboGrid', {
if (me.enableAfterLoad) {
delete me.enableAfterLoad;
me.setDisabled(false);
me.resumeEvent('validitychange');
me.isValid(); // if field was disabled then reenabled, validation status was lost
}
var def = me.getValue() || me.preferredValue;