1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
    joeshke is on a distinguished road

      0  

    Default Unanswered: Best way to load from SQLite DB when offline otherwise with ajax from json

    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:
    http://www.sencha.com/forum/showthre...ST2-(advanced)

    Thanks in advance

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,642
    Vote Rating
    899
    Answers
    3574
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    So you want to detect if the device is offline (navigator.onLine) and switch between the two sources?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    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 services@sencha.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.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    7
    Vote Rating
    0
    joeshke is on a distinguished road

      0  

    Default


    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?

    Thank you

Thread Participants: 1