PDA

View Full Version : GET / POST for ds.load paramters



ealameda
2 Mar 2007, 8:39 AM
(I asked this in the help forum earlier in the week but not responded so thought I'd try here)

It seems that if I add in parameters to a DataStore Load call (as I would for using the paging toolbar in a grid) - it submits the request as a POST. Is there a way to override that and have it submit a GET request with those params attached to the URL?

The reason I ask is because I was integrating a grid into a REST based application. So a GET request is used for getting data and POSTs are only used for creating or updating data.

Thanks!

Eldon

jack.slocum
2 Mar 2007, 8:48 AM
It's a config parameter to the HttpProxy (or Connection if used directly).


... new HttpProxy({
url: 'foo.php',
method: 'GET'
});

It can be set globally as well:

Ext.data.Connection.prototype.method = 'GET';

Or on individual requests:

store.load({method: 'GET', params: {foo: 'bar'}});

Animal
2 Mar 2007, 8:51 AM
You should be able to add the property method as the string "get" to your Store's baseParams object.