Results 1 to 4 of 4

Thread: IndexDB,SQL Lite support in Sencha Touch?

  1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    64
    Answers
    1

    Default IndexDB,SQL Lite support in Sencha Touch?

    Hi do Sencha Touch already support IndexDB ? Im currently using localStorage and it cant handle large data like 4000+ records for Offline scenario that's why our users is frustrated using my app .

    Im looking for other samples out there in using IndexDB and SQLlite using Sencha Touch/ Phonegap but cant find one.

    Do you have any suggestions? I read also that in iOS8 localStorage limit is 2.5 MB not like before which is 5MB.

    Any help is appreciated.

  2. #2
    Sencha Premium Member u25771's Avatar
    Join Date
    Sep 2012
    Location
    Switzerland :)
    Posts
    253
    Answers
    27

    Default

    Sencha does not support IndexDB or SQLite by default... but there are pretty alternatives.

    1. Use Web SQL, Sencha also has a proxy for this.
    2. As you are talking about SQLite you are going to have a wrapped app, simply use a cordova / phonegap plugin to communicate with a local SQLite Database.

    Hope this helps.
    Mark thread as answered if your problem could be solved and leave a vote for helpful answers

    For more help check out my new blog: http://abitofcoding.blogspot.com

    T
    o get in contact with me just send me a message on Google+

  3. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    64
    Answers
    1

    Default

    Hi u25771 , have you tried to use brodysoft sqlite plugin? I am successful putting it on my project but my problem now is i cant load the result of my code and load it on my list.

    How you load the data into the list without using Sencha Touch Store/Mode.

    Where i use
    Code:
    list.setStore(store);
    before.

    Code:
    db.transaction(function (tx) {            tx.executeSql("select DefectMatrixID,CustomerID,CustomerName,DefectType,DefectTypeName,Reference,Section,DefectDescription,SeverityID,SeverityName,IsActive,CreatedBy,CreatedDate  from DefectMatrix;", [], function (tx, results) {      
    //load all values to list 
      });        });
    Thanks

  4. #4
    Sencha Premium Member u25771's Avatar
    Join Date
    Sep 2012
    Location
    Switzerland :)
    Posts
    253
    Answers
    27

    Default

    Quote Originally Posted by good_c_ryan_19 View Post
    Hi u25771 , have you tried to use brodysoft sqlite plugin? I am successful putting it on my project but my problem now is i cant load the result of my code and load it on my list.

    How you load the data into the list without using Sencha Touch Store/Mode.

    Where i use
    Code:
    list.setStore(store);
    before.

    Code:
    db.transaction(function (tx) {            tx.executeSql("select DefectMatrixID,CustomerID,CustomerName,DefectType,DefectTypeName,Reference,Section,DefectDescription,SeverityID,SeverityName,IsActive,CreatedBy,CreatedDate  from DefectMatrix;", [], function (tx, results) {      
    //load all values to list 
      });        });
    Thanks
    Hey.

    Nope I've never used something like this. As I see you have two problems.

    1. You want to create a list without a store. In general I wouldn't go this way. I prefer to create a store where I put the data in from a DB-query. It's just easier and more stable. Anyway, HERE's an example how to create a list without seperate store class. Simply use the list.getStore().setData() to fill the data to the store.

    2. You need to get the data from a DB-query. This is how to:
    Code:
    var dbResult = new Array();
    _dbCon.transaction(function(tx) {
    
    
        tx.executeSql('SELECT * FROM dummyTable WHERE dummyCol = ?', [dummyVar],
            function(tx, results) {
                " success callback
                if (results.rows.length > 0) {
                    for (var i = 0; i < results.rows.length; i++) {
                      
                          " You could also add all row items by one... I prefere to loop them because usualy you want to do something on each row...
                        dbResult.push(results.rows.item(i));
                      
                    }
    
    
                } else {
                    " No result from database
                }
    
    
            },
            function(e) {
                " error callback
                alert(e);
            });
    });
    Hope this solves your problem. Else feel free to ask again
    Mark thread as answered if your problem could be solved and leave a vote for helpful answers

    For more help check out my new blog: http://abitofcoding.blogspot.com

    T
    o get in contact with me just send me a message on Google+

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •