我找不到这个例子,但我有那个答案的片段
var originalCheckValues = $.jgrid.checkValues,
originalHideModal = $.jgrid.hideModal,
iColWithError = 0;
$.jgrid.checkValues = function(val, valref, g, customobject, nam) {
var tr, td,
ret = originalCheckValues.call(this, val, valref, g, customobject, nam);
if (!ret[0]) {
tr = g.rows.namedItem(lastSel);
if (tr) {
$(tr).children('td').children('input.editable[type="text"]').removeClass("ui-state-error");
iColWithError = valref; // save to set later the focus
td = tr.cells[valref];
if (td) {
$(td).find('input.editable[type="text"]').addClass("ui-state-error");
}
}
}
return ret;
};