1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    73
    Vote Rating
    -1
    bstras21 is an unknown quantity at this point

      0  

    Default Finding a record?

    Finding a record?


    Hello, I am lopping a store to find a record and I can't seem to get it working correctly:

    HTML Code:
     me.offlineStore.load();
    Ext.Array.each(loadRecords, function(name, index) {
    var count = index + 1;
    
    
            if(!me.offlineStore.findRecord('ID', count)){
                console.log('record DOES NOT exists'+ count);
            }else{
                   console.log('record exists'+ count);
             }        
        
    
    
    });
    Now when I check my log (No data is in the store yet) I get this:

    record DOES NOT exists1Store.js
    :30record DOES NOT exists2Store.js
    :30record DOES NOT exists3Store.js
    :34record exists4Store.js
    :30record DOES NOT exists5Store.js
    :30record DOES NOT exists6Store.js
    :30record DOES NOT exists7Store.js
    :30record DOES NOT exists8Store.js
    :30record DOES NOT exists9Store.js
    :30record DOES NOT exists10Store.js
    :30record DOES NOT exists11Store.js
    :30record DOES NOT exists12Store.js
    :30record DOES NOT exists13Store.js
    :30record DOES NOT exists14Store.js
    :30record DOES NOT exists15Store.js
    :30record DOES NOT exists16Store.js
    :30record DOES NOT exists17Store.js
    :30record DOES NOT exists18Store.js
    :30record DOES NOT exists19Store.js
    :30record DOES NOT exists20Store.js
    :34record exists21Store.js
    :30record DOES NOT exists22Store.js
    :30record DOES NOT exists23Store.js
    :30record DOES NOT exists24Store.js
    :30record DOES NOT exists25Store.js
    :34record exists26Store.js
    :30record DOES NOT exists27Store.js
    :30record DOES NOT exists28Store.js
    :30record DOES NOT exists29Store.js
    :30record DOES NOT exists30Store.js
    :30record DOES NOT exists31Store.js
    :30record DOES NOT exists32Store.js
    :30record DOES NOT exists33Store.js
    :34record exists34Store.js
    :30record DOES NOT exists35Store.js
    :30record DOES NOT exists36Store.js
    :30record DOES NOT exists37Store.js
    :30record DOES NOT exists38Store.js
    :30record DOES NOT exists39Store.js
    :30record DOES NOT exists40Store.js
    :30record DOES NOT exists41Store.js
    :34record exists42Store.js
    :30record DOES NOT exists43Store.js
    :30record DOES NOT exists44Store.js
    :30record DOES NOT exists45Store.js
    :30record DOES NOT exists46Store.js
    :34record exists47Store.js
    :30record DOES NOT exists48Store.js
    :30record DOES NOT exists49Store.js
    :30record DOES NOT exists50Store.js
    :30record DOES NOT exists51Store.js
    :34record exists52Store.js
    :34record exists53Store.js
    :34record exists54

    I'm not sure what I'm doing wrong? Records should not be existing (I've removed the store many times and ran is with the same results). Should I be using a different method to check a store for a record? Thanks!

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Vote Rating
    834
    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


    localstorage does load too fast so you still need to think async. Try looping through the loadRecords on the load event.
    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
    Nov 2010
    Posts
    73
    Vote Rating
    -1
    bstras21 is an unknown quantity at this point

      0  

    Default Same results

    Same results


    I went and put the loop in the load callback function but I get the same results:

    Code:
    me.offlineStore.load({
       scope   : this,
         callback: function(records, operation, success) {
                  Ext.Array.each(loadRecords, function(name, index) {
                    var count = index + 1;
                    if(!me.offlineStore.findRecord('ID', count)){
                           console.log('record DOES NOT exists'+ count);
                   }else{
                               console.log('record exists'+ count);
                                        }        
                                    });
                                   
                          
                                
                             }
                     });

    record exists1
    Store.js:35record exists2
    Store.js:35record exists3
    Store.js:35record exists4
    Store.js:35record exists5
    Store.js:35record exists6
    Store.js:32record DOES NOT exists7
    Store.js:35record exists8
    Store.js:35record exists9
    Store.js:32record DOES NOT exists10
    Store.js:35record exists11
    Store.js:35record exists12
    Store.js:35record exists13
    Store.js:35record exists14
    Store.js:35record exists15
    Store.js:32record DOES NOT exists16
    Store.js:35record exists17
    Store.js:35record exists18
    Store.js:35record exists19
    Store.js:35record exists20
    Store.js:35record exists21
    Store.js:35record exists22
    Store.js:35record exists23
    Store.js:32record DOES NOT exists24
    Store.js:35record exists25
    Store.js:35record exists26
    Store.js:35record exists27
    Store.js:35record exists28
    Store.js:35record exists29
    Store.js:35record exists30
    Store.js:32record DOES NOT exists31
    Store.js:35record exists32
    Store.js:35record exists33
    Store.js:35record exists34
    Store.js:35record exists35
    Store.js:35record exists36
    Store.js:35record exists37
    Store.js:35record exists38
    Store.js:32record DOES NOT exists39
    Store.js:35record exists40
    Store.js:35record exists41
    Store.js:35record exists42
    Store.js:35record exists43
    Store.js:35record exists44
    Store.js:32record DOES NOT exists45
    Store.js:35record exists46
    Store.js:35record exists47
    Store.js:35record exists48
    Store.js:35record exists49
    Store.js:32record DOES NOT exists50
    Store.js:32record DOES NOT exists51
    Store.js:35record exists52
    Store.js:35record exists53
    Store.js:35record exists54

  4. #4
    Sencha User
    Join Date
    Nov 2010
    Posts
    73
    Vote Rating
    -1
    bstras21 is an unknown quantity at this point

      0  

    Default Timing issue

    Timing issue


    I believe you are correct that it is a timing issue, I tied it to a button and it seems to work, thanks!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi