简体   繁体   中英

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. 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.

Can anyone please help me.

Thanks in advance!

Looks like you have an extra , after { 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,

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

Let me know if this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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