PDA

View Full Version : extjs json store- params help



teja_0080
3 Jan 2011, 8:37 PM
Hi,

I'm using Json data store for my grid which has a paging tool bar at the bottom.
i call an aspx page for populating the data and load the store like the following.


store.load({
params: {
param1:Ext.getCmp('first').getValue(),
param2:Ext.getCmp('last').getValue(),
param3:Ext.getCmp('email').getValue(),
param4:Ext.getCmp('company').getValue(),
start:0,
limit:25
}
});

now when i click on the next page in the paging toolbar of the grid, my grid is not getting populated upon debuggin i found out that the params1,2,3,4 above are getting populated as null values and hence data is not fetched from the database.


Is there any way to get back the params1,2,3,4 values upon clicking the next button in the toolbar.

msinn
4 Jan 2011, 6:37 AM
maybe you destroy or reset the form after loading the store and showing the grid. Save the values in some accessible variables.

rivarecords
4 Jan 2011, 6:50 AM
You need to setBaseParam for each one. You could do that before your load and you would not have to pass the params or you could do what your doing and add a callback with the setBaseParam.

msinn
4 Jan 2011, 7:02 AM
you can also use the beforeload listener of your store



beforeload : function(store, options) {
store.setBaseParam('param1', varParam1Value);
store.setBaseParam('param2', varParam2Value);
store.setBaseParam('param3', varParam3Value);
store.setBaseParam('param4', varParam4Value);
}

teja_0080
4 Jan 2011, 8:17 PM
thanks for the help.

First i set the baseparams in the store.load method to include form values and then used params to set start and limit values, this way i could persist the value of the form elements between successive calls.