I've been working on a number of sencha touch forms in an app to handle CRUD operations and I can't seem to find the consistency in how data/models/proxy interact.
Most of these forms deal with nested data where there might be a model association like:
Even though a simple updateRecord() doesn't fill complex objects like the one above, I'm pretty much able to manually handle filling a model with data from a formpanel. That is not the pressing issue.
- hasMany ModelC
- hasMany ModelD
- hasMany ModelE
The difficulty is in figuring out how to get ALL the data output to JSON through the REST proxy. Can anyone explain the rules here? Because I can't seem to figure it out.
If I take an entire data hash representing the object structure above, and I do
then when I sync() the model's store with the server, all the data goes.
myModelA.setData( hugeDataHash )
But if I set the associated data via the associations like this:
then all of a sudden I just get "modelB:undefined" in the outgoing JSON when I sync() ModelA's store.
myModelA.getModelB().setData( modelBData )
Then I flip over to the hasMany associations and they go with the JSON regardless.
How are developers *supposed* to handle Create and Update functionality in forms with complex nested data?