私のコード: カスタム検証関数エラー pls ヘルプ >>>>
カスタム検証関数は値を返すことができません。json 関数はまだ機能していますが、値を返すことができませんでした
<script type="text/javascript">
$(document).ready(function () {
$.getJSON("/ChequeBookReceipt/getChequeType/", function (data) {
setupGrid(data.item);
});
function reload(result) {
$("#listChequeBook").trigger("reloadGrid");
}
});
function setupGrid(data) {
var success = false;
var message = 'success';
var item = data;
jQuery(document).ready(function () {
/*Begin Grid*/
$("#listChequeBook").jqGrid({
url: '/ChequeBookReceipt/GetChequeBookGrid/',
datatype: 'json',
mtype: 'GET',
data: $(this).serialize(),
colNames: ['Cheque Type', 'Book number', 'First Leaf Number', 'Last Leaf Number'],
colModel: [
{ name: 'chequeType', index: 'chequeType', editrules: { required: true }, width: 150, editable: true, sortable: false, sorttype: "text", edittype: "select", editoptions: { value: item }, formatter: "select", width: "200px" },
{ name: 'bookNumber', index: 'bookNumber',
editrules: { integer: true, required: true, custom: true,
custom_func: function (value, colname) {
$.ajaxSetup({ cache: false });
$.getJSON("/ChequeBookReceipt/IsUniqueBookNumber/", { value: value, colname: colname }, function (data) {
if (data != null) {
//alert(data.success + " - " + data.message);
return [data.success, data.message];
}
});
}
}, formoptions: { elmsuffix: ' *' }, sortable: false, width: 100, editable: true, sorttype: "text", width: "100px"
},
{ name: 'firstLeafNumber', index: 'firstLeafNumber', editrules: { integer: true, required: true }, formoptions: { elmsuffix: ' *' }, sortable: false, width: 100, editable: true, sorttype: "text", width: "100px" },
{ name: 'lastLeafNumber', index: 'lastLeafNumber', editrules: { integer: true, required: true}, sortable: false, width: 100, editable: true, sorttype: "text", width: "100px" }
],
rowNum: 10,
rowList: [10, 20, 30],
// loadonce: true,
ignoreCase: true,
autowidth: true,
sortname: 'bookNumber',
sortorder: "asc",
pager: jQuery('#pagerChequeBook'),
viewrecords: true,
caption: "Cheque Book",
editurl: "/ChequeBookReceipt/UpdateChequeBookGrid/",
// onSelectRow: function (id) {
// if (id && id !== "") {
// jQuery('#listChequeBook').editRow(id, true);
//
// }
// },
beforeRequest: function () {
$.getJSON("/ChequeBookReceipt/getChequeType/", function (data) {
item = data.item;
// setupGrid(data.item);
});
}
});
jQuery("#listChequeBook").jqGrid('navGrid', "#pagerChequeBook", { edit: false, add: false, del: true, search: false, refresh: false },
{ reloadAfterSubmit: true });
$("#listChequeBook").jqGrid('inlineNav', '#pagerChequeBook', { addParams: { addRowParams: {
"keys": true, "aftersavefunc": function () { var grid = $("#listChequeBook"); reloadgrid(grid); }
}
}, editParams: { "aftersavefunc": function () { var grid = $("#listChequeBook"); reloadgrid(grid); } }
});
function reloadgrid(grid) {
// grid.trigger("reloadGrid");
grid.setGridParam({ datatype: 'json', page: 1 }).trigger('reloadGrid');
}
/*End Grid*/
});
}
</script>
カスタム検証関数のエラーについて教えてください
助けてください