]> git.proxmox.com Git - proxmox-widget-toolkit.git/blobdiff - src/window/Edit.js
edit window: add extraParams config
[proxmox-widget-toolkit.git] / src / window / Edit.js
index bc8c50abaf7c0daa1a64297b18d08aefd4c9a921..f548196ba26ed4d095be5cbceaa4c66292077968 100644 (file)
@@ -7,6 +7,10 @@ Ext.define('Proxmox.window.Edit', {
     // set extra options like params for the load request
     autoLoadOptions: undefined,
 
+    // to submit extra params on load and submit, useful, e.g., if not all ID
+    // parameters are included in the URL
+    extraRequestParams: {},
+
     resizable: false,
 
     // use this to atimatically generate a title like `Create: <subject>`
@@ -62,6 +66,8 @@ Ext.define('Proxmox.window.Edit', {
        let me = this;
 
        let values = {};
+       Ext.apply(values, me.extraRequestParams);
+
        let form = me.formPanel.getForm();
 
        form.getFields().each(function(field) {
@@ -187,6 +193,12 @@ Ext.define('Proxmox.window.Edit', {
            waitMsgTarget: me,
        }, options);
 
+       if (Object.keys(me.extraRequestParams).length > 0) {
+           let params = newopts.params || {};
+           Ext.applyIf(params, me.extraRequestParams);
+           newopts.params = params;
+       }
+
        let createWrapper = function(successFn) {
            Ext.apply(newopts, {
                url: me.url,