I've a simple model -
Ext.define('MyModel', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.field.String'
],
fields: [
{
type: 'string',
name: 'currentA'
},
{
type: 'string',
name: 'currentB'
},
{
name: 'A'
},
{
name: 'B'
}
]
});
Here is some operation that I'm doing on the data for that model-
onBeforeRender: function(component, eOpts) {
var mystore = Ext.getStore('Mystore');
mystore.load({
callback: function(){
var entity = headerStore.getAt(0);
var bs = entity.data.B;
var as = entity.data.A;
var currentB = entity.data.currentB;
var currentA = entity.data.currentA;
bs.forEach(function(record) {
// do some operations
});
as.forEach(function(record) {
// do some other operations
});
}
});
}
Now, when iterating over variable "bs", which is clearly an array of objects, IE 8 complains
"Object doesn't support this property or method"
for the forEach function. This works fine in Chrome.
Here is the json for the model -
{
"currentA": "a",
"currentB": "b",
"A": [
{
"name": "a",
"id": 1
}
],
"B": [
{
"name": "b",
"id": 2
}
]
}
Why is IE not able identify it as an array?