I want to transform this json to Extjs Model:
{
"TableHour": {
"0": {
"Rx": 0,
"Tx": 0
},
"1": {
"Rx": 2,
"Tx": 0
},
"2": {
"Rx": 0,
"Tx": 0
},
"3": {
"Rx": 6,
"Tx": 0
}
}
}
I've tried :
Ext.define("TableHour", {
extend: 'Ext.data.Model',
hasMany: { model:'TableMode' }
});
Ext.define("TableMode", {
extend: 'Ext.data.Model',
fields: [
'Rx','Tx'
],
belongsTo: 'TableHour',
});
var store1 = Ext.create('Ext.data.JsonStore',{
autoLoad: true,
model:'TableHour',
proxy:{
type:'ajax',
url:'HoursReports.json',
reader:{
type: 'json',
}
}
});
console.log(store1.getAt(0));
But the last line, print "undefined". It's sure that model definition is wrong. The numbers "0" "1" "2" "3" aren't declared in my model beacause they're dynamically generated... how can i do?