Table 排序器初始页面大小不起作用

Table sorter initial page size doesn't work

我正在尝试使用寻呼机功能设置初始页面大小,但它不起作用。这是 javascript 和 HTML.

的内容

<link rel="stylesheet" href="/static/javascript/themes/blue/style.css" type="text/css" media="print, projection, screen" />
<script type="text/javascript" src="/static/javascript/jquery-1.11.2.min.js"></script> 
<script type="text/javascript" src="/static/javascript/jquery.tablesorter.js"></script>
<script type="text/javascript" src="/static/javascript/jquery.tablesorter.pager.js"></script>
<script type="text/javascript">
    $(function() {
        $("table")
            .tablesorter({widthFixed: true, widgets: ['zebra']})
            .tablesorterPager({container: $("#pager"), size: 10});

    });
    </script>


</head>

这里是 table:

    <table id="companies" class="tablesorter"> 
    <thead> 
      <tr>
        <th>Name</th> 
        ...

      </tr>
      </thead>
    <tbody>
</table>

<div id="pager" class="pager">
    <form>
        <img src="images/first.png" class="first"/>
        <img src="images/prev.png" class="prev"/>
        <input type="text" class="pagedisplay"/>
        <img src="images/next.png" class="next"/>
        <img src="images/last.png" class="last"/>
        <select class="pagesize">
            <option value="2">2 per page</option>
            <option value="5">5 per page</option>
            <option value="10">10 per page</option>

        </select>
    </form>
</div>

table 工作和排序,但我似乎无法控制的是分页级别。我知道我没有列出控件(为了保存 space),但我无法使初始页面大小正常工作。

您似乎在使用原始版本的 tablesorter(v2.0.5,来自 tablesorter.com)以及 jQuery v1.11.2。

问题是 jQuery $.browser function 在 jQuery v1.9+ 中被完全删除,所以 该代码将无法工作 因为有一个 javascript 错误阻止寻呼机插件完全初始化。

要解决此问题:

  1. 切换到 jQuery < 1.9.
  2. 试试我的 fork of tablesorter,其中包含大量修复和改进。
  3. 如果您选择坚持使用原始表格排序器,可以关注 GitHub repository, and an open issue 以获取更新。