PDA

View Full Version : Trying to understand HttpProxy api



Tonp
23 Mar 2010, 12:27 PM
Hi all,

I am busy learning Ext JS for a few weeks now and I understand most of it after a little practice.
One thing that still puzzles me is the api for the HttpProxy. I've read the documentation and have searched for examples. But no luck. My mind is still confused about it.



var proxy = new Ext.data.HttpProxy({
api: {
read : 'view.php,
create : 'create.php',
update: 'update.php',
destroy: 'destroy.php'
}
});


I understand how I can connect this proxy to a datastore. The thing I don't understand is how the proxy knows which api to use. Is this done automatically? Or do I need to fire an event of some sort?

I would appriciate a little more insight in the concept of this. It looks like a option to make (coding) life a little easier.

thanks,
Ton

steffenk
23 Mar 2010, 3:26 PM
Hi,

the Api object is something different, the following description from the docs makes it clear:

Ext.data.Api is a singleton designed to manage the data API including methods for validating a developer's DataProxy API. Defines variables for CRUD actions create, read, update and destroy in addition to a mapping of RESTful HTTP methods GET, POST, PUT and DELETE to CRUD actions.

The proxy is nothing more than a wrapper for handling data processes. You can define it once and use it in many objects.