View Full Version : Store / Load / Pass params

5 Mar 2011, 1:04 PM
Up until now, i have always used Ext.Ajax.request to get data from the serving, passing the necessary params to the server like so:

// Issue Ajax call to return data (pass params to server)
url: 'myUrl/getProductList',
params: {
param1: 1,
param2: 1

These params are added to the request and are immediately available on the server through the Request object.

Well, now I am trying to do things the new way using stores, models etc., but can't for the life of me figure out how to send the necessary params. If I place the proxy inside the Model declaration, and then simply call the store.load()....where do I set the params that I will be be getting from the the UI an will need to send along to the server to get the proper recs for the load() call?

So now I have a static Model configured like so:

Ext.regModel("Product", {
fields: [
{ name: "id", type: "string" },
{ name: "Name", type: "string" },
{ name: "Description", type: "string" },
{ name: "CatalogUrl", type: "string" }

proxy: {
type: 'ajax',
url: 'myUrl/GetProductList',
reader: {
type: 'json',
root: 'Products'


Then I have a dataview that has a store configured like so:

store: new Ext.data.Store({
model: 'Product',
autoLoad: false

And then I have method on the container component that I call the load the store as follows:

var store = Ext.getCmp('dvProductList').getStore();
scope: this,
callback: function (records, operation, success) {
// do stuff

Where/how in this configuration do I specify the params that I want to send along with the load request? All the example code I have found using the new data package does not seem to send any params. And what is the benefit of placing the proxy inside of the Model? I see this a lot in the newer videos and code, but I don't see the benefit.