View Full Version : Extraparams value in Ajax proxy not working (Ext JS 4; Firefox 5)

6 Jul 2011, 12:16 PM
Hello, I am new to Ext JS (using version 4) and have the following question:

I am trying to reload a grid base on the value of another field on the screen, the reloading is invoked when a button is clicked.

Here is the def of my datastore for the grid:

var dsGrid = new Ext.data.JsonStore({
autoLoad : false,
fields: ['fld1', 'fld2'],
proxy : {
type: 'ajax',
url: 'test.pgm',
extraparams: polnum : Ext.getCmp('NUMFLD').getValue()
reader: {
type: 'json',
root: 'somedata'

And in the button click event, I coded:

As I can see the app is running cause everytime I click the button, the browser invokes the program on my server, yet the "polnum" parameter is not reflecting to the NUMFLD's value on the screen. It's always 0, or if I set NUMFLD's value after the "Ext.onReady(function()" statement, then it's always that static value gets passed to the server program.

Could anyone point out what I've done wrong?


7 Jul 2011, 5:08 AM
Try adding this listener to your store:

var dsGrid = new Ext.data.JsonStore({
listeners: {
beforeload: function(store, operation){
this.proxy.extraParams['polnum'] = Ext.getCmp('NUMFLD').getValue()

I don't think it redoes the extraParam value when you load unless you explicitly tell it to update.

7 Jul 2011, 12:42 PM
Thanks very much, Mailisa. That does it.


9 Jul 2011, 6:41 PM
Mailisa's solution was correct, in terms of getting the current dynamic value before loading. However, your extraParams as specified should never have worked in the first place. You configured:

extraparams: polnum: Ext.getCmp('NUMFLD').getValue()

when it should have been:

extraParams: { polnum: Ext.getCmp('NUMFLD').getValue() }

Note the spelling, and formatting of extraParams as an object...

15 Sep 2011, 12:04 PM

17 Sep 2011, 9:50 AM

please mark the question as answered.