jqGrid的。分页根本没有显示

时间:2014-01-02 18:34:21

标签: javascript jquery jqgrid

所以我一直在使用jqgrid几天来建立一个我正在建设的网站,但从那以后我就无法让分页工作了,只是没有显示出来。我正在使用我的代码但尝试了相同结果的不同示例。

现在我正在使用此代码:

var mydata = [
    { num: "492", name: "Doug Anderson", trade: "WS" },
    { num: "696", name: "William Anderson", trade: "OP" },
    { num: "826", name: "Chris Autry", trade: "WF" },
    { num: "206", name: "Tom Beffa", trade: "OP" },
    { num: "799", name: "Glenn Bixler", trade: "LB" },
    { num: "360", name: "Pete Bober", trade: "OP" },
    { num: "7", name: "Scott Burgie", trade: "PFW" },
    { num: "476", name: "James Click", trade: "W" },
    { num: "775", name: "Bryan Darst", trade: "LB" },
    { num: "249", name: "Bob Dunham", trade: "LB" },
    { num: "10", name: "Tom Ekclund", trade: "WGF" },
    { num: "390", name: "Noel Edwards", trade: "W" }
        ];

        $("#testT").jqGrid({
            datatype: "local",
            data: mydata,
            colNames: ["Employee #", "Name", "Trade"],
            colModel: [
                { name: "num", width: 100, key: true, sorttype: "int" },
                { name: "name", width: 300 },
                { name: "trade", width: 80 },
            ],
            multiselect: true,
            pager: "#pager",
            rowNum: 10,
            rowList: [10, 20, 30],
            sortname: "num",
            sortorder: "desc",
            viewrecords: true,
            autoencode: true,
            height: "auto",
            gridview: true,
            caption: "Equipment"
        });

我在这样的对话框窗口中显示它:

$("#listView").dialog({ width: 680, maxWidth: 680, height: 600, maxHeight: 600, modal: true });

我见过这个例子,其他人说这个有用,但是我只是显示了10条记录而且找不到分页内容。

任何人都可以帮助我。

提前致谢!

2 个答案:

答案 0 :(得分:0)

,

之后,您似乎还有额外的{ name: "trade", width: 80 }

您的代码应为:

$("#testT").jqGrid({
    datatype: "local",
    data: mydata,
    colNames: ["Employee #", "Name", "Trade"],
    colModel: [
        { name: "num", width: 100, key: true, sorttype: "int" },
        { name: "name", width: 300 },
        { name: "trade", width: 80 } // Note the , has been removed
    ],
    multiselect: true,
    pager: "#pager",
    rowNum: 10,
    rowList: [10, 20, 30],
    sortname: "num",
    sortorder: "desc",
    viewrecords: true,
    autoencode: true,
    height: "auto",
    gridview: true,
    caption: "Equipment"
});

答案 1 :(得分:0)

您的网格正在为我工​​作,请点击此demo直播。 有了这个html部分应该,

<table id="testT">
<tr>
    <td />
</tr>
</table>
<div id="pager"></div>

如果有帮助,请告诉我。