]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
input panel: add onSetValues hook
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Nov 2022 14:16:39 +0000 (15:16 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 15 Nov 2022 14:16:43 +0000 (15:16 +0100)
As counter-part to `onGetValue`, which is for form assembly, add the
`onSetValues` helper that allows to hook into setting the values on
the fields, for example if one needs to transform a `disabled` to
`enable`.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/panel/InputPanel.js

index 85a13bdffa8f5d352820b773bc8b7adf56994856..34150ef9d32d3c2595edb75210e53b62239495f7 100644 (file)
@@ -57,12 +57,18 @@ Ext.define('Proxmox.panel.InputPanel', {
        }
     },
 
+    onSetValues: function(values) {
+       return values;
+    },
+
     setValues: function(values) {
        let me = this;
 
        let form = me.up('form');
 
-        Ext.iterate(values, function(fieldId, val) {
+       values = me.onSetValues(values);
+
+       Ext.iterate(values, function(fieldId, val) {
            let fields = me.query('[isFormField][name=' + fieldId + ']');
            for (const field of fields) {
                if (field) {