我不知道我的编码有什么问题?
colModel: [
{
key: true, hidden: true, name: 'Id', index: 'Id', editable: true
}, {
name: 'ProjectCode',
index: 'ProjectCode',
sorttype: "text",
edittype: "text",
editable: true,
editrules: {
required: true,
custom: true,
custom_func: function (value, colName) {
return validateDuplicateData(value, colName);
}
}
}
这是 validateDuplicateData 函数:
function validateDuplicateData(value, colName) {
var allRowsInGrid = $('#jqgrid').jqGrid('getRowData');
$.each(allRowsInGrid, function (k, v) {
if (v.ProjectCode == value) {
return [false, "Project code has been used. Please try using another code."];
}
});
}
为什么结果总是显示如下:
MessageBox : "自定义函数应该返回数组!"
请指教。。谢谢。。