1. #71
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    497
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    That shouldn't matter..

    What do you mean by the id column? The id shouldn't have a "column" in the database, it uses the sqlite _ROWID_ so I think strictly speaking this is more like the row numbers in excel than an actual column with values.

  2. #72
    Sencha User
    Join Date
    May 2012
    Location
    Glasgow, UK
    Posts
    17
    Vote Rating
    0
    henry.wilson is on a distinguished road

      0  

    Default


    Ahhh OK, is your code case sensitive? My column is named "Id" with a capital I, this may be the reason it's showing up as a column. I'm pulling this across in the data from my Web Service too but I'm guessing I don't need to set that value?

  3. #73
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    497
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    Ok so the first field must be of type int, and called "id" - case sensitive. This is an ID that the proxy must be left to generate and set all on its own. It will correspond with the _ROWID_ of the record in the database.

    If you have remote ID's as well you want to bring across, just call the field "r_id" or something and set them there.

    IDs get very confusing very quickly, especially here when Sencha Touch can easily get confused - what is the remote server, the sqlite database or the remote server serving the data? It kind of needs to be both for different reasons, so we need to keep the id's seperate. This allows us to use remoteFilter on sqlite stores to add where clauses to the select query on the proxy.

  4. #74
    Sencha User
    Join Date
    May 2012
    Location
    Glasgow, UK
    Posts
    17
    Vote Rating
    0
    henry.wilson is on a distinguished road

      0  

    Default


    Yeah I can see this causing all kinds of trouble. I don't actually need the Id column from the source database so I'll get rid of that. I think I've probably got the knowledge to get this working now...watch this space

  5. #75
    Sencha User
    Join Date
    May 2012
    Location
    Glasgow, UK
    Posts
    17
    Vote Rating
    0
    henry.wilson is on a distinguished road

      0  

    Default


    Great success! I've got a working sync now using a method similar to the code snippets gcw07 posted earlier in the thread. Need to test that it all works on an actual device (so far I've only tested with Google Chrome) but generally things are looking good. Thanks again for all your help guys

  6. #76
    Sencha User
    Join Date
    May 2012
    Location
    Glasgow, UK
    Posts
    17
    Vote Rating
    0
    henry.wilson is on a distinguished road

      0  

    Default


    Another question for you guys...

    I've got the app working happily on iPad. However when I eventually got it packaged for Android, I get no such luck, the app hangs at load time with the following error:

    05-21 13:27:51.710: E/Web Console(3063): Uncaught Error: [Ext.Loader] Failed loading 'app/util/InitSQLite.js', please verify that the file exists at file:///android_asset/sdk/src/chart/sencha-touch-debug.js:7896

    It looks like an issue with relative paths in the android packaging process. Has anyone successfully packaged an app for android using the SQLite Proxy? Any help would be appreciated.

  7. #77
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    497
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    Hi Henry,

    Where are you requiring the InitSQLite file? Is it's contents in the single app.js file generated by the sencha production/testing build?

  8. #78
    Sencha User
    Join Date
    May 2012
    Location
    Glasgow, UK
    Posts
    17
    Vote Rating
    0
    henry.wilson is on a distinguished road

      0  

    Default


    Hi Shepsii

    The top of my app.js has the require for the SQlite file:
    Code:
    Ext.Loader.setConfig({
       enabled: true
    });
    
    //<debug>
    Ext.Loader.setPath({
        'Ext': 'sdk/src',
        'Sqlite': 'sdk/sqlite',
        'Navis': 'app'
    });
    //</debug>
    
    Ext.require('Navis.util.InitSQLite');
    
    ...
    Not sure what you're referring to with regard to the sencha production/testing build? The android packaging process just spits out a .apk file. I've looked at the inside of that (using 7-zip) and the code structure seems to be the same as the original structure i.e. everything is in seperate files, not consolidated into one app.js.

  9. #79
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    497
    Vote Rating
    51
    shepsii has a spectacular aura about shepsii has a spectacular aura about shepsii has a spectacular aura about

      0  

    Default


    Hi Henry,

    How are you building this to a native app? It is my understanding that sencha app build native is no good for sqlite apps and we have to use phonegap instead. Data is not guaranteed to be persistent from load to load with sencha native packaging; while they do plan to support this in the future it's not there now and they don't have dates.

    The approach I will take when I'm doing this myself in a couple of weeks is:
    1. build using sencha app build production/testing
    2. package with phonegap (I've seen posts suggesting 1.6.1 is the optimal phonegap version for sencha touch 2)

    The issue you have right now is with the loader not working for some reason in the android app. Don't worry about this; package the app into a single js file using sencha app build and then package with phonegap.

  10. #80
    Sencha User
    Join Date
    May 2012
    Location
    Glasgow, UK
    Posts
    17
    Vote Rating
    0
    henry.wilson is on a distinguished road

      0  

    Default


    Hmmm OK just found this thread which states there is no Android 3 support, the tablet i'm using is Android 3 so that's probably the issue I'm having.