Results 1 to 5 of 5

Thread: Parameters not sent on form.load on Modern 6.6 framework

  1. #1
    Sencha User netnutmike's Avatar
    Join Date
    Jun 2008
    Location
    Frederick, MD
    Posts
    108

    Default Parameters not sent on form.load on Modern 6.6 framework

    Hi there,

    I know I am probably doing something wrong but I cannot get a form.load to pass extra parameters. This works fine on the classic framework. Below is the code I am trying to get to work. None of the params are being sent and I cannot figure out what I am doing wrong.

    Code:
        form.load({
                scope: this,
                url: '/data/getUnauthData.php',
                method: 'post',
                params: {
                    dataset: 'racesupportdetail',
                    uid: supportID
                },
                failure: function(form, action) {
                    Ext.Msg.alert("Load failed", action.result.errorMessage);
                }
            });
    Can someone point in the right direction?
    -------

    Mike Myers
    Frederick, MD

  2. #2
    Sencha Premium Member
    Join Date
    Jun 2012
    Posts
    19

    Default Same here

    Sencha, any comment? I am seeing the same thing in version 6.7. form.load() sends extra parameters in Classic but not Modern.

  3. #3
    Ext JS Premium Member tangix's Avatar
    Join Date
    Mar 2010
    Location
    Stockholm, Sweden
    Posts
    740
    Answers
    10

    Default

    Quote Originally Posted by andyo View Post
    Sencha, any comment? I am seeing the same thing in version 6.7. form.load() sends extra parameters in Classic but not Modern.
    Off the top of my head - isn't it baseParams in Modern?
    UPDATE: No, that's only for submit(), sorry.

  4. #4
    Sencha User
    Join Date
    Oct 2018
    Location
    Noida
    Posts
    67
    Answers
    10

    Default

    Hi @netnutmike and @andyo,

    Yes in modern toolkit params are not posted in form.load in modern toolkit BUT you can make it work in below two ways -
    1. You can post params in query string mode, so you can append your data in url like below -

    url: '/data/getUnauthData.php?dataset=acesupportdetail&uid=xxxxx-xxxx-xxx-xxxxx'.
    So you will see that those params will be posted in query string.

    2. If you don't like data to be posted in query string, you can add below override for load function in Ext.form.Panel class:

    Ext.define('My.Ext.form.Panel', {
    override: 'Ext.form.Panel',
    load: function (options) {
    options = options || {};

    var me = this,
    api = me.getApi(),
    url = options.url || me.getUrl(),
    waitMsg = options.waitMsg,
    successFn = function (response, data) {
    me.setValues(data.data);

    if (Ext.isFunction(options.success)) {
    options.success.call(options.scope || me, me, response, data);
    }

    me.fireEvent('load', me, response);
    },
    failureFn = function (response, data) {
    if (Ext.isFunction(options.failure)) {
    options.failure.call(options.scope, me, response, data);
    }

    me.fireEvent('exception', me, response);
    },
    load, args;

    if (options.waitMsg) {
    if (typeof waitMsg === 'string') {
    waitMsg = {
    xtype : 'loadmask',
    message : waitMsg
    };
    }

    me.setMasked(waitMsg);
    }

    if (api) {
    api = Ext.direct.Manager.resolveApi(api, me);
    me.setApi(api);

    load = api.load;

    if (!load) {
    Ext.raise("Cannot find Ext Direct API method for load action");
    }

    args = load.$directCfg.method.getArgs({
    params: me.getParams(options.params),
    paramOrder: me.getParamOrder(),
    paramsAsHash: me.getParamsAsHash(),
    scope: me,
    callback: function (data, response, success) {
    me.setMasked(false);

    if (success) {
    successFn(response, data);
    } else {
    failureFn(response, data);
    }
    }
    });

    load.apply(window, args);
    }
    else if (url) {
    return Ext.Ajax.request({
    url: url,
    timeout: (options.timeout || me.getTimeout()) * 1000,
    method: options.method || 'GET',
    autoAbort: options.autoAbort,
    // added below lines to post params in this case as well
    params: me.getParams(options.params),
    headers: Ext.apply(
    {
    'Content-Type' : 'application/x-www-form-urlencoded; charset=UTF-8'
    },
    options.headers || {}
    ),
    callback: function (callbackOptions, success, response) {
    var responseText = response.responseText,
    statusResult = Ext.data.request.Ajax.parseStatus(response.status, response);

    me.setMasked(false);

    if (success) {
    if (statusResult && responseText.length === 0) {
    success = true;
    } else {
    response = Ext.decode(responseText);
    success = !!response.success;
    }

    if (success) {
    successFn(response, responseText);
    } else {
    failureFn(response, responseText);
    }
    }
    else {
    failureFn(response, responseText);
    }
    }
    });
    }
    }
    });

    Hope that will solve your problem..

  5. #5
    Sencha User
    Join Date
    Sep 2007
    Location
    Phoenix AZ
    Posts
    120
    Answers
    5

    Default

    Thanks for submitting this override. This is a good example of the need of an override github repository. Would also be a place that Sencha engineers could get a head start on bug fixes. The overrides could be index with bug numbers.


    In 6.7.0 the modern toolkit the load method comes from the Ext.field.Panel (Ext.form.Panel extends Ext.field.Panel). So I think this override could be done by overriding Ext.field.Panel.

Similar Threads

  1. Combobox on Modern framework
    By marco.napetti in forum Ext JS 6.x Q&A
    Replies: 4
    Last Post: 3 Jan 2018, 12:02 AM
  2. Right click on modern framework
    By marco.napetti in forum Ext JS 6.x Q&A
    Replies: 5
    Last Post: 9 May 2017, 4:59 AM
  3. [FIXED] [6.2.1][modern/classic] Missing parameters in Ext.data.Model#load()
    By coyote01 in forum Sencha Documentation
    Replies: 1
    Last Post: 26 Apr 2017, 5:52 AM
  4. Replies: 1
    Last Post: 18 Apr 2017, 1:36 PM
  5. [FIXED] form load over ext.direct does not work with modern
    By ralscha in forum Ext JS 6.x Bugs
    Replies: 3
    Last Post: 7 Oct 2015, 5:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •