Combobox 网格内的组合框不';渲染后不显示数据
我有一个网格,其中一列上有combobox。数据在网格上加载良好。但当我双击一行以启用编辑时,组合框不会显示数据。(请参见下面的屏幕截图)突出显示的部分应显示“第一标签”。但当我开始编辑时,它会像第二行一样显示为“第二标签” 我在4.1上试过我的代码,效果很好。似乎4.2.2不喜欢网格中的组合框。非常感谢您的帮助 这是我的示例代码。请在Sencha的代码编辑器上试用它,以便在4.2.2和4.1.0上都能看到它Combobox 网格内的组合框不';渲染后不显示数据,combobox,grid,extjs4.2,roweditor,Combobox,Grid,Extjs4.2,Roweditor,我有一个网格,其中一列上有combobox。数据在网格上加载良好。但当我双击一行以启用编辑时,组合框不会显示数据。(请参见下面的屏幕截图)突出显示的部分应显示“第一标签”。但当我开始编辑时,它会像第二行一样显示为“第二标签” 我在4.1上试过我的代码,效果很好。似乎4.2.2不喜欢网格中的组合框。非常感谢您的帮助 这是我的示例代码。请在Sencha的代码编辑器上试用它,以便在4.2.2和4.1.0上都能看到它 Ext.define('GridModel', {
Ext.define('GridModel', {
extend: 'Ext.data.Model',
fields: [{
name: 'Id',
type: 'int'
}, {
name: 'Value',
type: 'int'
}]
});
Ext.define('ComboModel', {
extend: 'Ext.data.Model',
fields: [{
name: 'ComboId',
type: 'int'
}, {
name: 'Label',
type: 'string'
}],
idProperty: 'Order'
});
Ext.create('Ext.data.Store', {
storeId: 'comboStore',
model: 'ComboModel',
data: [{
ComboId: 1,
Label: '1st Label'
}, {
ComboId: 2,
Label: '2nd Label'
}]
});
Ext.create('Ext.data.Store', {
storeId: 'gridStore',
model: 'GridModel',
data: [{
Id: 1,
Value: 1
}, {
Id: 2,
Value: 2
}, {
Id: 3,
Value: 1
}, {
Id: 4,
Value: 2
}]
});
Ext.create('Ext.grid.Panel', {
width: 400,
height: 200,
renderTo: 'ct',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2,
listeners: {
edit: function(editor, e) {
console.log(gridStore.getModifiedRecords());
}
}
})
],
store: Ext.data.StoreManager.lookup('gridStore'),
forceFit: true,
columns: [{
dataIndex: 'Id',
header: 'ID'
}, {
dataIndex: 'Value',
header: 'Label',
editor: {
xtype: 'combobox',
displayField: 'Label',
valueField: 'ComboId',
queryMode: 'local',
store: Ext.data.StoreManager.lookup('comboStore'),
allowBlank: true
},
renderer: function(value) {
var rec = comboStore.getById(value);
return rec ? rec.get('Label') : value;
}
}],
renderTo: Ext.getBody()
});
只是渲染器中的代码上下文没有ComboStoreIgor。。。我遇到的另一个问题是4.2.2不喜欢外部定义的编辑器。现在它工作得很好。