核心思想是:
1.在设置grid的列的editor的时候,直接调用享用的编辑器的validateValue方法;
2.根据validateValue的结果设置列的样式.
1的示列代码如下:
1.在设置grid的列的editor的时候,直接调用享用的编辑器的validateValue方法;
2.根据validateValue的结果设置列的样式.
1的示列代码如下:
var text={allowBlank: false};
if (minfield)
text.minValue = minfield;
if (maxfield)
text.maxValue = maxfield;
text.validateValue=function(v) {
record._valid[columnIndex]=Ext.form.NumberField.prototype.validateValue.call(this,v);
return v;
};
this.colModel
.setEditor(
2,
new Ext.grid.GridEditor(new Ext.form.NumberField(text)));
2.列的渲染的方法
renderCol: function(value, metadata, record, rowIndex, colIndex, store) {
try{
if (record._valid && (record._valid[colIndex] === false)) {
metadata.css = 'x-grid3-invalid-cell';
}
}catch(err){
}
return value;
}