我在ExtJS中获取ComboBox以显示下拉项目时遇到问题.我最初使用XmlStore动态加载数据,但为了确保这不是问题,我采用了一个现有的ComboBox,它使用一个简单的ArrayStore(目前在我的应用程序的其他地方工作),看看它是否可行,仍然没有运气.
当使用Chrome的开发人员工具时,当我点击ComboBox元素时,我得到ext-all-debug.js:41166 - Uncaught TypeError: Cannot call method 'getStyle' of undefined并且没有显示任何下拉列表.
这是我的代码:
EventForm = Ext.extend(Ext.form.FormPanel, {
constructor: function(config) {
config = Ext.apply({
items: [
{
layout: 'column',
xtype: 'container',
items: [
{
layout: 'form',
xtype: 'container',
columnWidth: 0.5,
items: [
{
fieldLabel: 'My Combo Box'
name: 'mycombobox',
xtype: 'combo',
store: new Ext.data.ArrayStore({
fields: ['size'],
data: [
['50'],
['100'],
['150'],
['200']
]
}),
displayField: 'size',
valueField: 'size',
forceSelection: true,
editable: false,
triggerAction: 'all',
mode: 'local',
listWidth: 60,
width: 60
}
]
}, {
// another column here similar to above
}
]
}
]
}, config);
EventForm.superclass.constructor(config);
}
});
Run Code Online (Sandbox Code Playgroud)
您没有正确调用EventForm的超类的构造函数.将构造函数的最后一行更改为:
EventForm.superclass.constructor.call(this, config);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2447 次 |
| 最近记录: |