1. #1
    Sencha User
    Join Date
    Apr 2012
    Location
    Billerica, MA
    Posts
    56
    Vote Rating
    9
    jattardi will become famous soon enough

      0  

    Default Answered: Store data not containing all records??

    Answered: Store data not containing all records??


    I have a Store that loads its data via AJAX. There are 293 records, but only 6 items are being placed in the Store's data. I can't figure out what would be causing this!

    Here's the code for my Store:

    Code:
    Ext.define('MyApp.store.Audits', {
      extend: 'Ext.data.Store',
      
      config: {
        model: 'MyApp.model.Event',
        autoLoad: true,
        
        proxy: {
          type: 'jsonp',
          url: 'http://localhost:8080/events/audits?groups=all',
          reader: {
            type: 'json'
          }
        },
        
        listeners: {
          load: function(store, records, successful, operation, eOpts) {
            console.log(records.length);
            console.log(store.data.length);        
          }
        }
      }
    });
    As you can see, nothing fancy!
    But in my load listener, I get two different values printed.

    The first console.log statement has the correct number of records (295). But the second statement only prints out 6! I discovered this when I found that my List was only showing 6 records when I knew there were more.

    What could be causing this behavior? I checked some other Stores in my app and they are behaving the same way.

  2. Do you have duplicate id values being returned?

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    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

      1  

    Default


    Do you have duplicate id values being returned?
    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.

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Billerica, MA
    Posts
    56
    Vote Rating
    9
    jattardi will become famous soon enough

      0  

    Default


    Hi Mitchell,

    Thanks for the reply.

    What id values are you referring to? The records in the store?

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    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

      1  

    Default


    yes
    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.

  6. #5
    Sencha User
    Join Date
    Apr 2012
    Location
    Billerica, MA
    Posts
    56
    Vote Rating
    9
    jattardi will become famous soon enough

      0  

    Default


    Ahh! I think you're on to something. Looking at my raw data, there are indeed duplicate "id" values. This is because in the data representation we're using, "id" isn't a unique identifier for each record. As this is a list of events (for an event log), the "id" field refers to the id of the particular event type. So for example, a login event might have id 1234. So all the login events have an id of 1234.

    I'm assuming that the "id" field is interpreted by Sencha Touch as a unique identifier. Is there a way to change this behavior, or should I map the "id" value in the raw data to a differently-named field, like "eventId" ?

  7. #6
    Sencha User
    Join Date
    Apr 2012
    Location
    Billerica, MA
    Posts
    56
    Vote Rating
    9
    jattardi will become famous soon enough

      0  

    Default


    Mitchell,

    I've got it! I created a new autogenerated id field called 'recordId', and set the model's 'idProperty' config to refer to it, and now it loads all records.

    Thank you!

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