PDA

View Full Version : [store Idea] actionModels config property object for stores (or proxy ?)



benben
28 Jan 2012, 6:14 AM
I'm always fighting with stores and proxies with the following pattern :
one store <-> one web service
A webservice has one set of data for input , one set for output.
For example if it's a GET , input is going to be a set of ids and query parameters, and output is going to be an array of objects. If it's a POST , it's most likely the opposite : input is a JSON object, and output is a JSON object of "status" kind.

I'm thinking that it would be great if we could provide this kind of per-action input/output Model definition at the store level (or proxy ?), then let sencha do the binding for us, using this kind of definition :

For a proxy with :


actionMethods:{create: "POST", read: "GET"}

We would have at the store level :


actionModels:{
create:{send:"app.model.Item", receive:"app.model.Status"},
read:{send:"app.model.ItemSearchEngineQuery", receive:"app.model.ItemList"}
...
}

It seems more suited for a specific WebService class , but since urls are already specified at proxy level and model at store level, i'm thinking that maybe one of those two classes could make it.

Or maybe there already is a pattern for doing those things ?