{
xtype: 'grid',
id: 'gridMatch',
layout: 'fit',
height: 250,
selModel: {
type: 'cellmodel'
},
plugins: {
ptype: 'cellediting',
clicksToEdit: 1
},
store: Ext.create('fieldMatchStore'),
columns: [
{ xtype: 'rownumberer' },
{ text: '电子表字段', dataIndex: 'EField' },
{
text: '数据库字段', dataIndex: 'DField',
editor: {
xtype: 'combo',
store: storeField,
emptyText: '--请选择--',
queryMode: 'local',
displayField: 'value',
valueField: 'value',
forceSelection: true,
triggerAction: 'all',
editable: false,
listeners: {
select: function (combo, record, eOpts)
var fname = record.get('value');
var dfield = record.get('id');
var efield = Ext.getCmp('gridMatch').getSelectionModel().getSelection()[0].data.EField;
post('/fieldmatch/SetMatch', { type: 1, efield: efield, dfield: dfield, fname: fname }, function (data) }, function ()
combo.clearValue();
var row = Ext.getCmp('gridMatch').getSelectionModel().getSelection()[0];
row.set('DField','');
});
}
}
}
}
]
}

数据库字段是一个下拉框,在选择后会向后台传递数据,在数据库中检查是否已有字段匹配,如果没有,就正常添加,如果已有就返回错误,这时需要清除下拉框的值,用combo.clearValue(),但这样还是不够的,还需将这一行的这个单元格给清空,否则会显示刚选择的下拉框的值,

var row = Ext.getCmp('gridMatch').getSelectionModel().getSelection()[0];
row.set('DField','');

找到所在行,即当前选择行,设置该列绑定的model值为空即可。