I’m using ExtJs4 and I’m trying to extend the Ext.form.field.ComboBox like below:
Ext.define('GenericCombo', {
extend: 'Ext.form.field.ComboBox',
alias: 'widget.genericcombo',
//the constructor
constructor: function(config) {
var store = new Ext.data.JsonStore({
fields: ['Key', 'Value'],
data : config.combodata || []
});//new Ext.data.Store
Ext.apply(this, config, {
store: store,
displayField: 'Value',
valueField: 'Key',
queryMode: 'local',
emptyText:'Select a value...'
});
this.callParent([this]);
}//end constructor
});//end Ext.define
The data for the store i.e. config.combodata is returned in JSON format like below:
"combodata":[
{"Key":"","Value":"<None>"},
{"Key":"!#","Value":"Dr"},
{"Key":"!$","Value":"Miss"}
]
However I get an error on line 61312 of ext-all-debug.
(inside the renderActiveError method).
Error: Uncaught TypeError: Cannot read property 'dom' of null
Line 61312 :
me.errorEl.dom.innerHTML = activeError;
Am I missing something obvious here?
EDIT: Adding some code where I instantiate it:
I actually instantiate the combobox dynamically i.e. The server returns some extjs code dynamically in JSON format like below:
{
"anchor":"50%",
"autoScroll":false,
"border":false,
"combodata":[
{"Key":"","Value":"<None>"},
{"Key":"!#","Value":"Dr"}
],
"fieldLabel":"Title",
"name":"3820",
"value":"!)",
"xtype":"genericcombo"
}
However When i try to hardcode it i get the same error. Hardcoded example:
xtype: 'form',
title: 'A Form',
items:[{
xtype: 'genericcombo',
fieldLabel: 'Test',
combodata: [{Key: 'one', Value: 'two'}]
}]
I was calling
The correct way is to call