如果我使用这个:
loadComplete: rowCount()
它不工作。
如果我们直接打电话,我想知道为什么它不起作用的原因。
代码片段:
function rowCount() {
var recCount = $("#fbDetailTable").jqGrid('getGridParam', 'records');
if (recCount == 0) {
displayMessage("Freight bill not found");
} else {
displayMessage("Freight bill found");
}
}
function getFreightBill() {
var frtBill = document.getElementById("freightBill").value;
if (isNaN(frtBill)) {
displayMessage("Freight bill contain digits alone");
} else {
var intTemplate = {
sorttype: "integer",
formatter: "text",
align: "center"
};
var dateTemplate = {
sorttype: "date",
formatter: "date",
align: "center"
};
$("#fbDetailTable").jqGrid('GridUnload');
$("#fbDetailTable").jqGrid({
url: "/BSNReportBatch/rs/FBService/getFB?fB=" + frtBill,
datatype: "json",
colNames: ["Store Number", "Order Number", "SKU number",
"Shipped Quantity", "Order Created Date"],
colModel: [{
name: "strNbr",
template: intTemplate
}, {
name: "orderNbr",
template: intTemplate
}, {
name: "skuNbr",
template: intTemplate
}, {
name: "shpdQty",
template: intTemplate
}, {
name: "ordCrtDt",
template: dateTemplate
}],
cmTemplate: {
width: 180
},
jsonReader: {
repeatitems: false,
id: "strNbr",
root: function (obj) {
return obj;
}
},
pager: "#fbPager",
rowNum: 50,
rowList: [50, 100, 200],
sortName: "strNbr",
sortOrder: "desc",
gridview: true,
autoencode: true,
height: "auto",
viewrecords: true,
loadonce: true,
caption: "Order Details",
loadComplete: function () {
rowCount();
}
});
}
}