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":"[email protected]"
}
}
]
}
}
}
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