【发布时间】:2016-04-14 12:20:59
【问题描述】:
我有一个网格,其中有一列带有如下定义的编辑器。
this.accrualGrid = new Ext.grid.GridPanel({
store: store,
id:'accrualGrid_add',
plugins :[this.cellEditing],
columns: [
{header: 'Milestone Description', width: 340, dataIndex: 'Description',
getEditor: function(record) {
if(Ext.getCmp('accrualGrid_add').store.indexOf(record)==0)
{
return Ext.create('Ext.grid.CellEditor', {
field: Ext.create('Ext.form.field.Text', {
id:'MDesc_Add',
validator:function(val){
if(val=="")
return false;
else
return true;
},
})
});
}
}
}]
每次加载网格时,在我们单击该单元格之前,我都无法访问编辑器内的文本字段。
Ext.getCmp('MDesc_Add') 给出未定义的值。
单击该单元格后,它会为我提供文本字段对象。
如何在网格加载或设置网格数据时访问文本字段对象??
【问题讨论】:
-
你想达到什么目的?
-
我想在设置数据时验证字段中的值(如果无效则显示红色边框),而不是点击字段