PDA

View Full Version : Question on setting params for scriptTagProxy



brumble
23 Mar 2007, 7:43 PM
Hi, I'm trying out to populate a Grid with data in Json format. May i know how do i set params in the Post for retrieving data from my sql server? I tried something like this:


var ds = new Ext.data.Store({
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.ScriptTagProxy({
url: 'http://www.myurl.com',
trans: {params: createParams()}
}),
function createParams(){
var params = {};
for(var myKey in this.baseParams){
if(typeof this.baseParams[myKey] != 'function'){
params[myKey] = this.baseParams[myKey];
}
}
params['id'] = '1'; //hardcoded for now
params['totalCount'] = '574'; //hardcoded for now
return params;
};
//...

I'm not sure if its right. I hope someone would correct me. Thanks!

Animal
23 Mar 2007, 10:37 PM
You specify params in the load method of Store:



myStore.load({params:{id:1, totalCount: 574}});


or in the baseParams property:



myStore.baseParams = {id:1, totalCount: 574};


baseParams are used in every load operation.

brumble
24 Mar 2007, 5:42 AM
alright, thanks man.. i'll try it out..