proxmox checkbox: add clearOnDisable config
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
55e47317c0
commit
4ec859d9bc
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user