6 Nov 2012 7:02 AM #1
Unanswered: Synchronising multiple data stores with a single request
I would like to send records from 2 related stores to the server with a single request. The reason being is that I want the records to be created as part of the same transaction on the server, as well as reduce the number of requests needed as I could see that a single action on the client my affect many stores in the future. I understand that models on the client can have associations, does this in any way facilitate my requirements? I also understand that a model or store has its own proxy and it doesin't seem like there is a way to create a third proxy that is consious of more than model/store at the same time.
For example I might have a customer model and a order model. When a new customer places an order I want only one request going to the server containing the customer and order details. Tomorrow this request may contain a customer, order, order items, item configuration, payment details, shipping details and any number of other objects.
Anyone have any experience with something like this or any thoughts on how to facilitate using the data store/model pattern in Sencha Touch?
Last edited by jay252; 6 Nov 2012 at 7:03 AM. Reason: formatting
8 Nov 2012 6:13 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
I would almost think that it's going to take too much time for you and may be over your head to start hacking at the framework to get this working. Instead, I would just use Ext.Ajax and then update the stores in the response.Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
8 Nov 2012 7:12 AM #3
Thanks Mitchell, I'm on board with your thought to use Ext.Ajax and manually update the stores once I receive my response.
I think I will have the problem that the records I add or update in the store manually will be marked as dirty. I don't see how I can mark them as being clean since the setDirty method does not take a parameter. Would I need to remove all my proxies if I wanted to proceed with the manual synchronisation? Having the ability to mark a record as clean would help in this case.