12 Jul 2012 5:27 AM #1
Unanswered: Best way to load from SQLite DB when offline otherwise with ajax from json
First of all hello!
I'm now two weeks in touch with sencha and I like it really! Now I have to find a good way for loading items in the store either via ajax request (json format) which loads me the new data when the user is online or load existing data from the local SQLite DB.
In addition the SQLite DB data should be replaced with the new data from the json.
I'll use this SQLite Proxy:
Thanks in advance
14 Jul 2012 6:46 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
So you want to detect if the device is offline (navigator.onLine) and switch between the two sources?Mitchell Simoens @LikelyMitch
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 email@example.com
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.
14 Jul 2012 7:01 AM #3
Thanks for your reply Yes, at the moment I'm editing the SQLite Proxy read method and check if the user is online. If the user is online a new store will be created with an ajax /json proxy and if it is loaded the data will be applied to the SQLite DB and refresh the list. Do you think it's the best way? Maybe you can give me some other ideas?