Reputation: 8962
I didn't understand well the idea behind of proxies in ExtJS. Can I use simple functions with them in order to read and save data using only one url? Such as when I want to read data: users.read()
and when I want save the new and edited fields of a grid: users.save()
?
Upvotes: 0
Views: 926
Reputation: 926
I don't think I could answer your question any better than if you were to read the following article.
Sencha > Learn > The Data Package
Upvotes: 1
Reputation: 17000
yes you can use functions as users.save()
and users.read()
and this functions will use urls which you provide for these methods in Proxy.
proxy: new Ext.data.HttpProxy({
api: {
create:{
url: '/users/create',
method: 'POST'
},
read: {
url: '/users/read',
method: 'POST'
},
update: {
url: '/users/update',
method: 'POST'
},
destroy: {
url: '/users/delete',
method: 'POST'
}
}
}),
or
proxy : new Ext.data.HttpProxy({
method: 'GET',
prettyUrls: false,
url: 'local/default.php',
api: {
// all actions except the following will use above url
create : 'local/new.php',
update : 'local/update.php'
}
}),
Upvotes: 1