分页在 jqgrid 中不起作用,loadonce:false

Paging is not working in jqgrid, loadonce : false

我想在 jqgrid 中显示 json 数据。我已将 loadonce 设为 false,总记录在网格寻呼机中正确显示,但页面索引始终是 1 of 1。感谢任何帮助。

代码:

var LoadCDHDetailsGrid = function (backstageViewByVal, bossStoreDate, filterflag, getBackStageDataFromCache, inboundViewType, carrierViewBy, featured) {
    BackstageInboundbuildSearchFilters();
    var mygridwidth = $('.tablegriddiv').width();
    var defaultSort = "expectedDeliveryDate";

    var url = featured ? '/Inbound/RetrieveFeaturedInboundData/' : '/Inbound/RetrieveCDHInboundDetailsData/';
    jQuery("#BackStageGrid").jqGrid({
        url: url,
        postData: { searchfilters: JSON.stringify(BackstageAdvfilters), advf: advf, customsortname: customsortname, customsortorder: customsortorder, filterflag: filterflag, storeDt: bossStoreDate, GetFromCache: getBackStageDataFromCache, packageType: inboundViewType, selectedviewTransfers: backstageViewByVal, carrierView: carrierViewBy },
        datatype: 'json',
        mtype: 'POST',
        colNames: ['Tracking #', 'Carton #', 'Delivery Date', 'Status', 'Status Date', 'Status Time'],
        colModel: [
                            { name: 'bakTrackingNbr', jsonmap: 'trackingLabelNbr', index: 'trackingLabelNbr', width: 170, formatter: commonWorkloadFunctions.trackingHyperlinkFormatter, unformat: commonWorkloadFunctions.trackingnHyperlinkUnFormatter, align: 'center', search: true, classes: "underlineres" },
                            { name: 'bakCarton', jsonmap: 'cartonNumber', index: 'cartonNumber', width: 145, align: 'center', search: true, formatter: commonWorkloadFunctions.cdhCartonHyperlinkFormatter, unformat: commonWorkloadFunctions.cartonHyperlinkUnFormatter, classes: "underlineres" },
                            //Added for SSW2- 292
                            { name: 'bakExpectedDelDate', jsonmap: 'expectedDeliveryDateTime', index: 'expectedDeliveryDate', width: 125, align: 'center', sorttype: 'date', formatter: 'date', formatoptions: { srcformat: "ISO8601Long", newformat: "m/d/Y" }, search: true },
                             {
                                 name: 'bakStatus', jsonmap: 'status', index: 'Status', width: 150, align: 'center', formatter: 'select',
                                 edittype: 'select', editoptions: {
                                     value: workloadGridDropdownColumnsList.statusListBackstage(),
                                     defaultValue: 'ALL',
                                     multiple: true,
                                     width: '200'
                                 },
                                 stype: 'select', searchoptions: {
                                     sopt: ['eq', 'ne'],
                                     value: workloadGridDropdownColumnsList.statusListInBoundBackstage(),
                                     attr: { multiple: 'multiple', size: 5 },
                                     dataInit: dataInitMultiselect
                                 }
                             },

                            { name: 'bakStatusDate', jsonmap: 'statusDate', index: 'StatusDate', width: 100, align: 'center', search: true },
                            { name: 'bakStatusTime', jsonmap: 'statusTime', index: 'StatusTime', width: 80, align: 'center', search: false },
        ],

        pager: '#BackStageGridPager',
        rowNum: 30,
        width: mygridwidth,
        gridview: true,
        ignoreCase: true,
        cmTemplate: { resizable: false },
        sortname: 'trackingLabelNbr',
        sortname: defaultSort,
        viewrecords: true,
        sortorder: 'asc',
        sortable: false,
        scrollable: true,
        loadonce: false,
        shrinkToFit: true,
        onSelectRow: function (rowid, status, e) {
            backstageGridBuiltinFunctions.backstageGridOnSelectRow(rowid, status, e);
        },
        beforeRequest: function () {
            if (toolbarBackStatusSel.length == 0) {
                $("input:checkbox[name=multiselect_gs_bakStatus]:checked").each(function () {
                    toolbarBackStatusSel.push($(this).attr('value'));
                    bakstatusValue += $(this).attr('value') + ",";
                });

                if (bakstatusValue.length >= 1 && advfilters !== '') {
                    for (var i = 0; i < advfilters.length; i++) {
                        if (advfilters[i].SearchingName == 'Status')
                            advfilters.splice(i, 1);
                    }
                    advfilters.push({ SearchingName: "Status", SearchingValue: (bakstatusValue.replace(/,\s*$/, '')) });
                }
            }
            jQuery("#BackStageGrid").jqGrid('setGridParam', { postData: { searchfilters: JSON.stringify(advfilters), advf: advf, customsortname: customsortname, customsortorder: customsortorder, filterflag: filterflag, storeDt: bossStoreDate, GetFromCache: getBackStageDataFromCache, packageType: inboundViewType, selectedviewTransfers: backstageViewByVal, carrierView: carrierViewBy } });

            if (typeof $("#gs_bakTrackingNbr").val() !== 'undefined') {
                baktrackingNoValue = $("#gs_bakTrackingNbr").val();
            }
            if (typeof $("#gs_bakCarton").val() !== 'undefined') {
                bakcartonNoValue = $("#gs_bakCarton").val();
            }
            if (typeof $("#gs_bakExpectedDelDate").val() !== 'undefined') {
                bakexpectedDelDateValue = $("#gs_bakExpectedDelDate").val();
            }

            if (typeof $("#gs_bakPackageType").val() !== 'undefined') {
                bakpackageTypeValue = $("#gs_bakPackageType").val();
            }
            if (typeof $("#gs_bakStatusDate").val() !== 'undefined') {
                bakstatusDateValue = $("#gs_bakStatusDate").val();
            }
            if (typeof $("#gs_bakStatusTime").val() !== 'undefined') {
                bakstatusTimeValue = $("#gs_bakStatusTime").val();
            }

        },
        onPaging: function () {
            filterflag = false;
            getBackStageDataFromCache = true;
        },
        loadComplete: function (data) {
            backstageGridBuiltinFunctions.backstageGridViewLoadComplete(data);

        },
        loadError: function (xhr, status, error) {
            filterflag = true;
            getBackStageDataFromCache = false;
            commonFunctions.spmDialogueAlert("Data service connectivity error.");
            commonWorkloadFunctions.hideLoadingMessage();
        },
        height: "400",
        timeout: 600000
    }).trigger("reloadGrid");

    var theGrid = jQuery("#BackStageGrid");
    theGrid.jqGrid('navGrid', '#BackStageGridPager', { refreshstate: 'current', edit: false, refresh: false, search: false, del: false, add: false });
    theGrid.jqGrid('filterToolbar', { stringResult: true, searchOnEnter: true, defaultSearch: myDefaultSearch, beforeSearch: BackStageInboundBeforeSearchHandler });
};

我试过使用 loadonce 作为 true。然后分页工作,但在搜索值时,网格是空白的。没有记录返回。我的数据从网络服务返回。数据没有问题。

我能够通过发送记录计数、页面索引和数据来解决问题。我之前没有发送过。