1. #1
    Sencha User Baron89's Avatar
    Join Date
    Aug 2012
    Posts
    58
    Vote Rating
    0
    Baron89 is on a distinguished road

      0  

    Default what's the type of 'records' in callback(records,option,success) in json store.load

    what's the type of 'records' in callback(records,option,success) in json store.load


    Hi all,i tried to use the data(records) returned from the server,but dont know what type of the data is,my code is like below .seems it's an array,but i just cant use the its elements.
    Code:
    xxx.store.load(//json store  {   
       callback: function(records, options, success){    
             this.reader.jsonData.groups.group1;//i can call it like this   
             records.groups;//doesnt work    
             records[0];//[object Object]    
             records[0].group1;//undefined   
             records.length==6//      
    }  });
    data from server
    Code:
    {
         "groups" : {
               "group1" : "Week33",
               "group2" : "Week34",
               "group3" : "Week35", 
               "group4" : "Week36",  
         },  
         "rows": [   {  "data1":"data"   }  ],  
         "success" : true, 
         "metaData" : null,
         "cacheName" : "",
         "totalRowCount" : 6
     }

  2. #2
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      1  
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  3. #3
    Sencha User Baron89's Avatar
    Join Date
    Aug 2012
    Posts
    58
    Vote Rating
    0
    Baron89 is on a distinguished road

      0  

    Default


    Hi Sword,do you know why i get the error ' records.get is not a function ' when i try to use the function that belongs to Ext.data.Record?

  4. #4
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      1  

    Default


    Hi,

    you can try this:


    Code:
     for(var i=0; i< records.length;i++){
        records[i].get('propertyname');
    }
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  5. #5
    Sencha User Baron89's Avatar
    Join Date
    Aug 2012
    Posts
    58
    Vote Rating
    0
    Baron89 is on a distinguished road

      0  

    Default


    Hi Sword,the function 'get' works now according to what u said.but still cant get the data.
    like
    Code:
    records[0].get('groups') ;//undefined

  6. #6
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,333
    Vote Rating
    85
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      0  

    Default


    Hi,

    you can use like this one:

    Code:
    records[0].get('group1')
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  7. #7
    Sencha User Baron89's Avatar
    Join Date
    Aug 2012
    Posts
    58
    Vote Rating
    0
    Baron89 is on a distinguished road

      0  

    Default


    Quote Originally Posted by sword-it View Post
    Hi,

    you can use like this one:

    Code:
    records[0].get('group1')
    Hi,I finally get the data like below
    record[0].get('data1')
    let me show you my store code
    Code:
     var WorkOrderRecord = Ext.data.Record.create([
         {name: 'data1'}  ]);
      myStore = Ext.extend(Ext.ux.MultiGroupingStore, {
        constructor: function(cfg) {
            cfg = cfg || {};
            myStore.superclass.constructor.call(this, Ext.apply({
                
                proxy: new Ext.data.HttpProxy({
                 method: 'POST',
                 url: '**/test.json'
                }),
                autoLoad: false,   
                
                reader: new Ext.data.JsonReader({
                root: 'rows',
                successProperty: 'success',
                messageProperty: 'message',
                totalProperty: 'total',         
        
       },
       WorkOrderRecord    
       )
     }));
        }
    });

  8. #8
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      1  

    Default


    Providing your root config in the beginning would've helped

    I really would recommend using Firebug and the console.log() function, since this would've helped you to see exactly what type of object records was, and what the child names are.

  9. #9
    Sencha User Baron89's Avatar
    Join Date
    Aug 2012
    Posts
    58
    Vote Rating
    0
    Baron89 is on a distinguished road

      0  

    Default


    Hey buddy,how to use firebug to see the child names of records?

  10. #10
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    52
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      1  

    Default


    console.log(records)

    https://getfirebug.com/logging

Thread Participants: 2

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