ExtJS-EditorGridPanel:选择单元格时出错
在EditorGridPanel中选择单元格时出错。以下是我的代码片段:ExtJS-EditorGridPanel:选择单元格时出错,extjs,combobox,grid,Extjs,Combobox,Grid,在EditorGridPanel中选择单元格时出错。以下是我的代码片段: var bannerGrid = new Ext.grid.EditorGridPanel({ store: bannerStore, cm: new Ext.grid.ColumnModel({ defaults: { sortable: true, menuDisabled: true },
var bannerGrid = new Ext.grid.EditorGridPanel({
store: bannerStore,
cm: new Ext.grid.ColumnModel({
defaults: {
sortable: true,
menuDisabled: true
},
columns:
{
header: '<img src="img/oo-icon.png" /> <img src="img/network-icon.png" />',
width: 52,
dataIndex: 'inventory',
align: 'center',
renderer: inventoryIcon,
}, {
header: "Name",
dataIndex: 'bannerName',
editor: new Ext.form.TextField({ allowBlank: false }),
width: 300
}, {
header: "Advertiser",
dataIndex: 'advertiser',
editor: advertisersDropdownGrid,
}, {
header: "Art Type",
dataIndex: 'artType',
editor: artTypeDropdownGrid,
}, {
......
同样,这只发生在组合框编辑器上
通过进一步检查,错误来自ext本身的这一部分:
onFieldShow: function(c){
c.getItemCt().removeClass('x-hide-' + c.hideMode);
if (c.isComposite) {
c.doLayout();
}
},
这似乎是FormLayout部分的一部分
有什么想法吗?我尝试过定义组合的内联,但没有解决它
谢谢
编辑:下面是我如何使用类定义我的组合
我定义了我的ComboBoxJSON类:为了隐私起见,我省略了名称空间
***.***.***.ComboBoxJSON = Ext.extend(Ext.form.ComboBox, {
url: '',
root: '',
valueField: 'id',
displayField: 'name',
width: 200,
id: '',
fields: [
{ name: 'id', type: 'int'},
{ name: 'name', type: 'string' }
],
initComponent: function () {
var comboStore = new Ext.data.JsonStore({
id: 'JsonStore',
idProperty: 'id',
autoLoad: true,
idProperty: 'id',
root: this.root,
fields: this.fields,
proxy: new Ext.data.ScriptTagProxy({
api: {
read: this.url,
}
})
});
var config = {
store: comboStore,
displayField: this.displayField,
valueField: this.valueField,
mode: 'local',
minChars: 1,
triggerAction: 'all',
typeAhead: true,
lazyRender: true,
value: this.value,
width: this.width,
id: this.id
}
Ext.apply(this, config);
***.***.***.ComboBoxJSON.superclass.initComponent(this);
}
});
Ext.reg("ibwComboJson", ***.***.***.ComboBoxJSON);
然后在网格上init之前定义我的组合,如下所示:我已经屏蔽了URL,但它确实返回了有效的JSON
var advertisersDropdownGrid = new ***.***.***.ComboBoxJSON({
url: '***',
root: 'advertiserList',
id: 'advertisersDropdownGrid'
});
不久前找到了这个问题的答案,但解决方法非常简单
***.***.***.ComboBoxJSON.superclass.initComponent.call(this);
忘记了。通话部分: 一个工作的showcase可以帮助你向我们展示广告商DropDownGrid吗?我刚刚注意到你在column模型中的columns属性是错误的,你的column对象应该位于分配给columns属性的数组中,这只是一个复制粘贴错误吗?@Jaitsu:是的,只是一个复制粘贴错误,让我试着为你们制作一个工作示例。你们能给我们展示一下你们的组合框代码吗?
***.***.***.ComboBoxJSON.superclass.initComponent.call(this);