Send Extra Parameters to ExtJS store

Sometimes in ExtJS we have a requirements to send some extra parameters to the grid’s store on the fly.
Lets say we have a grid having store “DummyStore”, and a combo-box of users and we want to send the selected user id as a parameter to the grid’s store on select event of the drop down.

To achieve this in select event of combo-box the load event of the store can be written as:

Ext.getStore('DummyStore').load({
    callback : function(records, operation, success) {
        // Callback code
    },
    params : {
        'user_id' : Ext.getCmp('user_combobox').getValue()
    }
});

You can see that Request query string parameter has a field called user_id with the selected value of combo-box.

Simple isn’t it. 🙂 Happy Coding.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s