Store with type memory not loading the data
I am getting json response and am trying to put json in store but it is not loading it properly.
HTML Code:
Ext.Ajax.request({
url: url,
success: function(xhr) {
response = Ext.JSON.decode(xhr.responseText.trim()); //alert(xhr.responseText.trim());
for(i=0;i< response.data.length; i++) { instancestore[i] = Ext.create('Ext.data.Store', {
autoLoad: true,
model: 'RA.model.DataModel',
proxy: {
type: 'memory',
data: response,
reader: {
type: 'json',
root: 'data'
}
}
});
}
My Json output is :
HTML Code:
{ "data":
[{ "0": [{ "DowntimeEvents": 179, "DowntimeHours": 78355 }] }, { "1": [{ "DowntimeEvents": 176, "DowntimeHours": 97835 }] }, { "2": [{ "DowntimeEvents": 140, "DowntimeHours": 100501 }] }]}
I tried below code but it is passing null value of DowntimeEvents and DowntimeHours in the store.
HTML Code:
Ext.Ajax.request({
url: url,
success: function(xhr) {
response = Ext.JSON.decode(xhr.responseText.trim());
//alert(xhr.responseText.trim());
for(i=0;i< response.data.length; i++) { alert(response.data[0].DowntimeEvents);
instancestore[i] = Ext.create('Ext.data.Store', {
autoLoad: true,
model: 'RA.model.DataModel',
data: response.data[i],
proxy: {
type: 'memory',
reader: {
type: 'json',
}
}
});
}