PDA

View Full Version : how can we change actionmethods property of Ext.data.proxy.Ajax at run time ?



manikumar
30 May 2012, 12:45 AM
how can we change actionmethods property of Ext.data.proxy.Ajax at run time ?

scottmartin
3 Jun 2012, 4:40 PM
You will have to create a new instance to make changes.

Scott.

skirtle
3 Jun 2012, 7:41 PM
Take a look at getMethod, that's the only place actionMethods is used:

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.proxy.Ajax-method-getMethod
http://docs.sencha.com/ext-js/4-1/source/Ajax2.html#Ext-data-proxy-Ajax-method-getMethod

If the correct method is determined by some property of the request then you can just implement that logic by overriding getMethod, that's what it's for.

Failing that, you can set the value of actionMethods to be whatever you want but you need to be careful with shared references. The proxy is often shared and the actionMethods object is also shared across proxy instances, so make sure you have it clear in your head exactly what you're changing before you start tweaking it. Generally you should replace the whole actionMethods object, don't update the properties within it.

manikumar
3 Jun 2012, 10:51 PM
can you write the code to do that