简体   繁体   English

jqgrid。 分页根本不显示

[英]jqgrid. Paging not showing at all

So I've been using jqgrid for a couple of days for a website I'm building but since then I cannot get the paging to work it just doesn't show up. 所以我已经在建立的网站上使用jqgrid了几天,但是从那以后我无法使页面正常工作,只是它没有出现。 I was using my code but tried different examples with the same result. 我正在使用我的代码,但尝试了具有相同结果的不同示例。

Right now I'm using this code: 现在,我正在使用以下代码:

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"
        });

I am displaying it on a dialog window like this: 我在这样的对话框窗口中显示它:

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

I've seen this example used by other people who say this works but mine just shows 10 records and the paging stuff is nowhere to be found. 我已经看到其他人使用过这个示例,他们说这行得通,但是我的仅显示10条记录,而找不到分页的东西。

Can anyone please help me. 谁能帮帮我吗。

Thanks in advance! 提前致谢!

Looks like you have an extra , after { name: "trade", width: 80 } { name: "trade", width: 80 }之后,您似乎有多余的{ name: "trade", width: 80 }

Your code should be: 您的代码应为:

$("#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"
});

Your grid is working for me, Checkout this demo for live. 您的网格对我有用,请观看此演示以进行实时演示 With this html part should like, 有了这个html部分,

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

Let me know if this helps. 让我知道是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM