Results 1 to 2 of 2

Thread: RootProperty in Store For Nested JSON Object

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    30
    Vote Rating
    2
      0  

    Default RootProperty in Store For Nested JSON Object

    Hi i am trying to load to load a store with rest api call , i am getting nested json object in server response but when i am trying to load my store in callback i am not getting any records .
    This is how my response json looks like

    Code:
    {
        "Search":{
            "Header":{
                "Status":"100",
                "Message":"SUCCESS"
            },
            "TotalCount":"124",
            "ResourceList":{
                "Resource":[
                    {
                        "BasicInformation":{
                            "ResourceID":"13892",
                            "FullName":"xyz Olalde",
                            "SupervisorID":"12493",
                            "SupervisorName":"Lokesh Balasubramanian",
                            "ProfileStatus":"Active",
                            "Role":"Supervisor",
                            "RoleID":"1",
                            "InterviewerID":"",
                            "LegacyID":"87",
                            "ResourceType":"Nielsen Full Time Employee"
                        },
                        "ContactDetails":{
                            "PContactNumber":"988665544",
                            "ContactEmail":"abraham.olalde@some.com"
                        }
                    }
    
                ]
            }
        }
    }
    
    

    And my store is defined like this

    Code:
    Ext.define('QualityControl.store.Resource',{
        extend:'Ext.data.Store',
    
        requires:[
            'Ext.data.field.Field'
        ],
    
        constructor:function(cfg){
            var me =this;
            cfg = cfg ||{};
            me.callParent([Ext.apply({
                storeId:'CommandCenter.Resource',
                pageSize:10,
                proxy:newExt.data.proxy.Rest({
                    method:'POST',
                    url:AppUrl.searchresource,
                    actionMethods:{
                        create:'POST',
                        read:'POST',
                        update:'POST',
                        destroy:'POST'
                    },
                    reader:{
                        type:'json',
                        totalProperty:'TotalCount',
                        rootProperty:'ResourceList.Resource.BasicInformation.',
                       // record:'BasicInformation'
    
                    },
    
                    fields:[
                        { name:'ResourceID'},
                        { name:'FullName'},
                        { name:'SupervisorID'},
                        { name:'SupervisorName'},
                        { name:'ProfileStatus'},
                        { name:'Role'},
                        { name:'RoleID'},
                        { name:'InterviewerID'},
                        { name:'LegacyID'},
                        { name:'ResourceType'},
    
                    ]
                }),
            }, cfg)]);
        }
    });
    
    

    i am loading my store in controller like this


    Code:
     Store.load({
         callback: function (records, operation, success) {
             console.log(records);
         }
     });
    I guess problem is with my rootProperty but i am not able to figure out how to solve this .
    Any help would be appreciated .
    Thanks

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,354
    Answers
    3997
    Vote Rating
    1499
      0  

    Default

    The Resource key is an array, not an object.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Similar Threads

  1. Replies: 1
    Last Post: 21 Apr 2014, 6:04 PM
  2. Replies: 3
    Last Post: 17 Apr 2013, 6:03 AM
  3. Replies: 1
    Last Post: 22 Nov 2012, 6:20 AM
  4. Store && Json => Get data next to rootProperty
    By cuva in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 5 Nov 2012, 10:04 AM
  5. Nested Data in JSON object
    By trondina in forum Sencha Touch 2.x: Q&A
    Replies: 4
    Last Post: 4 Apr 2012, 12:44 PM

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
  •