editgrid 画面提交前的输入项合法check
function checkInputBeforSave(tmpGrid, tmpStore) {
// 取得当前变更的信息进行判断
var modrows = tmpStore.modified;
for (var i = 0; i < modrows.length; i++) {
// 取得该行的所有的列属性
var fields = modrows[i].fields.keys;
// 取得当前行的记录
var record = modrows[i];
// 逐个判断当前行内所有单元格的内容
for (var j = 0; j < fields.length; j++) {
var name = fields[j];
// 取得当前单元格输入的内容
var value = modrows[i].data[name];
// 取得数据的所在列
var colIndex = tmpGrid.getColumnModel().findColumnIndex(name);
// 取得数据的所在行
var rowIndex = tmpStore.indexOfId(record.id);
// 判断是否被隐藏的的列和可编辑的列
if (tmpGrid.getColumnModel().isHidden(colIndex) != false
&& tmpGrid.getColumnModel().isCellEditable(colIndex) == true) {
// 取得当前列的 编辑器的内容
var editor = tmpGrid.getColumnModel().getCellEditor(colIndex, rowIndex).field;
// 判断当前列的输入内容是否合法
if (!editor.validateValue(value)) {
Ext.Msg.alert('提示', '请确保输入的数据正确!', function() {
tmpGrid.startEditing(rowIndex, colIndex);
})
return false;
}
} else {
continue;
}
}
}
return true;
}
以上为EditGridPanel在提交后台前的画面内容check方法