PDA

View Full Version : How to load data to multiple stores with one request in Sencha Touch?



Nicodemuz
22 Mar 2011, 11:45 PM
Hi,

I'm developing a Sencha Touch application that has multiple data stores. In order to improve performance, I would like to load the data to these stores in a single HTTP request.

For this to work, the server would output different JSON root elements, one for each store. How can this be done in Sencha Touch?

Any advice would be much appreciated. I've also posted this on Stack Overflow if you'd like to get some extra reputation points! :)
http://stackoverflow.com/questions/5402153/how-to-load-data-to-multiple-stores-with-one-request-in-sencha-touch

crysfel
23 Mar 2011, 1:06 AM
You should make an "Ext.Ajax.request()", in the success config you need to decode the json, after that you need to add the records to the store that you need.

I hope that helps.

Best regards

StuartAshworth
23 Mar 2011, 1:51 AM
This is a prime candidate for Ext.Direct. However it's not officially supported at the moment but is planned to be once Ext4 is out the door.

Check out these threads:
http://www.sencha.com/forum/showthread.php?115987-Touch-with-Direct
http://www.sencha.com/forum/showthread.php?109565-Ext-Direct

However, in the meantime crysfel's way is probably the best way to do it.