0

问题:我从服务器发送 10 行(假设 jqgrid 每次请求 10 行)。

第一次提取:发送/显示 10 行(id:1 到 10)在网格中查看 1 - 10 的 25

第二次获取:发送/显示 10 行(id:11 到 20)在网格中查看 11 - 20 的 25

第三次获取:发送 5 行/显示 10 行(id:21 到 25 和再次 21 到 25)在网格中查看 21 - 30 的 25

属性集(来自业务层):page=3,records=25

javascript:

<script type="text/javascript">
$(function() {
    $("#list").jqGrid({
        url : contextPath + "/getEntities",
        datatype : 'json',
        mtype : 'GET',
        jsonReader : {
            root : "response",
            page : "page",
            total : "total",
            records : "records",
            repeatitems : false

        },
        colNames : [ 'Inv No', 'Date', 'Amount', 'Tax', 'Total', 'Notes' ],
        colModel : [ {
            name : 'invid',
            width : 55,
            index : 'invid',
            sortable : true,
            sorttype : 'text',
            key : true
        }, {
            name : 'invdate',
            index : 'invdate',
            width : 90,
            sorttype : 'date',
            sortable : true
        }, {
            name : 'amount',
            index : 'amount',
            width : 80,
            align : 'right'
        }, {
            name : 'tax',
            index : 'tax',
            width : 80,
            align : 'right'
        }, {
            name : 'total',
            index : 'total',
            width : 80,
            align : 'right'
        }, {
            name : 'note',
            index : 'note',
            width : 150,
            sortable : false
        } ],
        pager : '#pager',
        rowNum : 10,
        rowList : [ 10, 20, 30 ],
        sortname : 'invid',
        sortorder : 'desc',
        viewrecords : true,
        gridview : true,
        caption : 'My first grid'
    });
});

下面是json数据:

{"total":3,
"response":[
{"total":"490","amount":"500","invdate":"12-12-12","invid":"21","tax":"10","note":"OK"},
{"total":"490","amount":"500","invdate":"12-12-12","invid":"22","tax":"10","note":"OK"},
  {"total":"490","amount":"500","invdate":"12-12-12","invid":"23","tax":"10","note":"OK"},
{"total":"490","amount":"500","invdate":"12-12-12","invid":"24","tax":"10","note":"OK"},
  {"total":"490","amount":"500","invdate":"12-12-12","invid":"25","tax":"10","note":"OK"}],
"page":3,
"records":25}

注意:invid 在所有行中都包含唯一值,因此在 colModel 中定义为键。同样对于第 3 次提取,我会请求 10 行但从服务器接收 5 行。网格不应该显示 5 并且不重复行,因为我设置了重复项:false。我还设置了records=25,同时将json数据发回显示。这不意味着总记录 = 25。为什么它显示 25 的 21-30 视图?

请帮忙...

4

1 回答 1

0

抱歉,我无法重现您描述的问题。演示显示正确的结果

在此处输入图像描述

于 2013-05-12T21:06:58.277 回答