diff --git a/src/form/Checkbox.js b/src/form/Checkbox.js index 2b29e1c..529bfbe 100644 --- a/src/form/Checkbox.js +++ b/src/form/Checkbox.js @@ -6,6 +6,7 @@ Ext.define('Proxmox.form.Checkbox', { defaultValue: undefined, deleteDefaultValue: false, deleteEmpty: false, + clearOnDisable: false, }, inputValue: '1', @@ -31,6 +32,19 @@ Ext.define('Proxmox.form.Checkbox', { return data; }, + setDisabled: function(disabled) { + let me = this; + + // only clear on actual transition + let toClearValue = me.clearOnDisable && !me.disabled && disabled; + + me.callParent(arguments); + + if (toClearValue) { + me.setValue(false); // TODO: could support other "reset value" or use originalValue? + } + }, + // also accept integer 1 as true setRawValue: function(value) { let me = this;