ilhan
ilhan

Reputation: 8952

Sending parameters in ExtJS 4.1

This is my code:

Ext.define('gridOptionsModel', {
    extend: 'Ext.data.Model'
});

var gridOptionsStore = Ext.create('Ext.data.JsonStore', {
    autoDestroy: true,
    model: 'gridOptionsModel',
    proxy: {
        type: 'ajax',
        actionMethods: 'POST',
        url: '/application.php?way=system&case=updateFields41',
        extraParams: {meta: 'true'},
        reader: {
            type: 'json',
            root: 'gridoptions'
        }
    }
});

And this is the part where it reloads the data from the url but does not send the desired parameters

gridOptionsStore.load({proxy: {
   extraParams: {gridData: grid.getState()}}
});

I have tried everything possible but cannot made it to POST the gridData parameter.

Upvotes: 2

Views: 2730

Answers (2)

marfalkov
marfalkov

Reputation: 835

instead of setting a property directly, use a method when available:

gridOptionsStore.getProxy().setExtraParam('gridData', grid.getState());

Upvotes: 1

nscrob
nscrob

Reputation: 4493

you can add the extra param before the load.

gridOptionsStore.getProxy().extraParams.gridData = grid.getState();
gridOptionsStore.load();

This works for me.

Upvotes: 4

Related Questions