PDA

View Full Version : POST parameters in ajaxProxy



jad_Topnetwork
5 Feb 2014, 5:51 AM
Hello every one

How to add POST parameters in ajaxProxy when calling load store's method.

Thanks in advence

skirtle
5 Feb 2014, 6:21 AM
To set the method to POST instead of GET for a load use actionMethods or override getMethod.

To pass the parameters...

You can pass parameters directly into the load method if you're calling it manually.

You can use extraParams instead if they're fixed for all requests through the proxy.

Use a beforeload listener on the store if you need to hook in dynamically. See the source to Ext.ux.grid.FiltersFeature for an example.

Alternatively, you can do all kinds of magic if you write a proxy subclass:

http://skirtlesden.com/articles/custom-proxies

jad_Topnetwork
5 Feb 2014, 6:26 AM
I want to have some parameters in GET method and some other in POST, is it possible ?

skirtle
5 Feb 2014, 6:39 AM
Do you mean you want some parameters on the URL and some in the request body for the same request?

If you set the method to POST then the params will be used as post parameters. To add GET parameters too you could either bolt them onto the url yourself (either via the url config or maybe via an override of buildUrl if they're dynamic) or set some urlParams in an override of buildRequest. urlParams is an undocumented option for Ext.Ajax.request.

I suggest that you study the code for Ext.data.Connection, Ext.data.proxy.Ajax and Ext.data.proxy.Server - that's all I'm doing to answer your questions.

jad_Topnetwork
5 Feb 2014, 6:42 AM
Ok, that's very interesting.
Thank you for your time.