PDA

View Full Version : Param with a scriptTagProxy CRUD api/JsonStore



Aero
18 Jul 2010, 1:43 PM
Hi,
I just implemented my first CRUD application, with the ScriptTagProxy api. Now,i would like to pass a param to the reader url so i can select and fetch data with a query server side.

As far as i can see (and test) this can be done in serveral ways.

First i can use the setApi for the proxy to re-configure the read url. But This means
sending the variable as a url and catch it, i would like to include it as a param.

So my second thought was,can this param be sent by the JsonStore (not dealing with the proxy url istelf) by just passing


Store.setBaseParams.myAction = myVariable;


Does this baseParam get send to the read url ?? (i cant test it right now)

Third,the proxy itself seems to have baseparam option


proxy: new Ext.data.ScriptTagProxy({
url: '..',

}),
baseParams: {
myAction: 'myVariable'

}


Again,what is the correct method to pass the param when the scriptTag is using the CRUD api



var crudProxy = new Ext.data.ScriptTagProxy({
api : {
read : 'url1',
create : 'url2',
update : 'url3',
destroy : 'url4'
}

Sorry if this has been asked many times before and thanks in advance!:)

Animal
18 Jul 2010, 9:15 PM
What does this mean?



First i can use the setApi for the proxy to re-configure the read url. But This means
sending the variable as a url and catch it, i would like to include it as a param.


Set the URL to contain the param. It is all you can do.

Condor
18 Jul 2010, 9:55 PM
ScriptTagProxy doesn't have a baseParams config option! The config option you are looking for is called 'extraParams'.

Store does have a baseParams config option, but you are using it wrong:

store.setBaseParam('myAction', myVariable);

ps. A ScriptTagProxy can only do GET requests, so the parameter will always be part of the URL query.