samedi 24 mai 2014

Cannot read property 'indexOf' of undefined

I don't understand why I'm getting this error, all I'm trying to do is associate a generic store with a combobox to display the values from the store and I keep getting this error for some reason.

comboBox:



Code:



{
xtype: 'combobox',
anchor: '100%',
itemId: 'testComboBox',
maxWidth: 300,
width: 1130,
fieldLabel: 'Type',
labelWidth: 50,
displayField: 'label',
store: 'TestStore',
valueField: 'label'
}

store:

Code:



Ext.define('MyApp.store.TestStore', {
extend: 'Ext.data.Store',


requires: [
'MyApp.model.TestModel'
],


constructor: function(cfg) {
var me = this;
cfg = cfg || {};
me.callParent([Ext.apply({
autoLoad: true,
model: 'MyApp.model.TestModel',
storeId: 'TestStore',
data: [
{
catid: '1',
label: 'issue 1',
type: 'incident'
},
{
catid: '2',
label: 'issue 2',
type: 'incident'
},
{
catid: '3',
label: 'issue 3',
type: 'incident'
},
{
catid: '4',
label: 'issue 4',
type: 'incident'
}
]
}, cfg)]);
}
});

model:

Code:



Ext.define('MyApp.model.TestModel', {
extend: 'Ext.data.Model',


requires: [
'Ext.data.Field'
],


idProperty: 'catid',


fields: [
{
name: 'catid'
},
{
name: 'label'
},
{
name: 'type'
}
]
});

the combo box displays the values when i click on the drop down button, but it gets stuck with a loading message and I get the error mentioned above, could someone tell me what the problem is here please? am I missing something?


Aucun commentaire:

Enregistrer un commentaire