mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-08-07 03:14:12 +00:00
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,
|
defaultValue: undefined,
|
||||||
deleteDefaultValue: false,
|
deleteDefaultValue: false,
|
||||||
deleteEmpty: false,
|
deleteEmpty: false,
|
||||||
|
clearOnDisable: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
inputValue: '1',
|
inputValue: '1',
|
||||||
@ -31,6 +32,19 @@ Ext.define('Proxmox.form.Checkbox', {
|
|||||||
return data;
|
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
|
// also accept integer 1 as true
|
||||||
setRawValue: function(value) {
|
setRawValue: function(value) {
|
||||||
let me = this;
|
let me = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user