我正在使用jqGrid,我已经通过deparment进行了分页和分组,我有超过一千行,每个部门超过200行,我每页显示100行,所以每个页面都有问题我能看到只有一个组在页面中有前100个记录,当所有行完成后,可以看到其他组的部门。但实际上我想在第一页和扩展中显示所有组我想要显示前100条记录,然后分页和所有组相同。 JqGrid有可能吗?如果是,那怎么样?
我目前的代码是
var ParsedJson = JSON.parse(result.BatchRpt);
jQuery("#tblBatchReport").jqGrid({
data: ParsedJson,
datatype: "local",
height: 'auto',
width: 'auto',
rowNum: 100,
rowList: [10, 20, 30, 50, 100],
colNames: ['Date', 'Time', 'CC #', 'Department', 'Amount', 'AuthCode', 'Invoice#'],
colModel: [
{ name: 'BillDate', index: 'BillDate', width: 90, sorttype: "date", summaryType: 'count', summaryTpl: '({0}) total', resizable: false, },
{ name: 'BillTime', index: 'BillTime', width: 90, sorttype: "date", resizable: false, },
{ name: 'AccNo', index: 'AccNo', width: 130, resizable: false, },
{ name: 'Department', index: 'Department', width: 100, resizable: false, },
{ name: 'BillAmount', index: 'BillAmount', width: 80, align: "right", sorttype: 'number', formatter: 'number', summaryType: 'sum', resizable: false, },
{ name: 'AuthCode', index: 'AuthCode', width: 100, resizable: false, },
{ name: 'RegisterInvNo', index: 'RegisterInvNo', width: 100, resizable: false, },
],
pager: "#tblBatchReportPager",
viewrecords: true,
sortorder: "desc",
caption: "Batch Report",
//sortname: 'DeptName',
grouping: true,
hidegrid: false,
groupingView: {
groupField: ['Department'],
groupDataSorted: false,
groupText: ['<b>{0} - {1} Department(s)</b>'],
groupCollapse: true,
groupOrder: ['asc'],
groupSummary: [true],
//groupSorted: false,
},
footerrow: true,
userDataOnFooter: true,
onClickGroup: function (hid, collapsed) {
//saveCollapsedStateToLocalStorage(hid, collapsed)
var i;
i = $.inArray(hid, expandedGroups) > -1;
if (!collapsed && i == false) {
expandedGroups.push(hid);
}
else if (collapsed && i == true) {
//Grouphid.splice(i, 1);
expandedGroups.splice($.inArray(hid, expandedGroups), 1);
}
},
loadComplete: function () {
var ActiveTab = $("#divBatchReportSection").find('.tabs').find('.active a').attr('data-TabIndex');
if (ActiveTab == "1") {
jQuery("#tblBatchReport").jqGrid('groupingRemove', true);
}
//else if (ActiveTab == 2)
//{
// jQuery("#tblBatchReport").jqGrid('groupingGroupBy', ['CardType']);
//}
var $this = $(this),
//sum = $this.jqGrid("getCol", "SalesPrice", false, "sum"),
$footerRow = $(this.grid.sDiv).find("tr.footrow"),
localData = $this.jqGrid("getGridParam", "data"),
totalRows = localData.length,
totalSum = 0,
totalCostSum = 0,
$newFooterRow,
i;
for (i = 0; i < totalRows; i++) {
totalSum += parseFloat(localData[i].BillAmount, 10);
}
$footerRow.find(">td[aria-describedby=" + this.id + "_BillDate]")
.text("Grand Total:");
$footerRow.find(">td[aria-describedby=" + this.id + "_BillAmount]")
.text($.fmatter.util.NumberFormat(totalSum, $.jgrid.formatter.number));
if (expandedGroups.length > 0) {
for (var i = 0; i <= expandedGroups.length; i++) {
if (typeof (expandedGroups[i]) != "undefined") {
$this.jqGrid("groupingToggle", expandedGroups[i]);
}
}
}
}
});
jQuery("#tblBatchReport").jqGrid('navGrid', '#tblBatchReportPager', { add: false, edit: false, del: false });
jQuery("#tblBatchReport").setGridWidth("100");
}