11

According the the jqGrid documentation, I should be able to place the pager above or below the jqGrid by moving the pager div. Unfortunately, the pager always renders below the grid.

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

The jqGrid configuration (related to the pager) looks like:

pager: '#pager',
pginput: false,
pgbuttons: false,

Any suggestions?

4

2 回答 2

35

您应该改用toppager:truejqGrid 选项。您不需要定义<div id="pager"></div>和使用pager: '#pager'参数。jqGrid 顶部的寻呼机 id 将是“list_toppager”(表元素的 id 附加“_toppager”)。

如果要添加导航器,可以使用

$("#list").jqGrid('navGrid','#list_toppager');

如果您使用定义<div id="pager"></div>和使用pager: '#pager'参数,您将有两个 寻呼机:一个id="list_toppager"在网格顶部,另一个id="pager"在底部。如果您想同时使用顶部和底部寻呼机,您可以使用

$("#list").jqGrid('navGrid','#pager',{cloneToTop:true});

然后移动或删除(有关更多详细信息和演示示例,请参见另一个答案)。您还可以使用jQuery.insertAfter函数非常轻松地将按钮从一个工具栏移动到另一个工具栏(请参见此处)。

于 2010-12-09T20:41:11.757 回答
0

使用 $ 附加。上表的html是这样的

<div id="export"></div>                        

添加 id 并使用 promise().done(): "exportButton"

$(grid).jqGrid('navButtonAdd', self.options.pagerSelector, { id: "exportButton", caption: "Export to CSV", buttonicon: "ui-icon-newwin", onClickButton: function() { self._exportToCSV(self, grid); }, position: "last", title: "Export to CSV", cursor: "pointer" })
.promise().done(function() {
    //reposition export button
    $("#export").append($("#exportButton"));
    $("#exportButton").addClass("pull-right").show();
});
于 2014-01-27T21:30:23.727 回答