【问题标题】:Jquery tablesorter pagination is not separating pages correctly on initial loadJquery tablesorter 分页在初始加载时未正确分隔页面
【发布时间】:2015-05-15 21:31:24
【问题描述】:

所以我正在使用带有 tablesorter (tablesorter.com) 的分页插件,并且我更改了页面大小下拉框中的值,但它无法正确调整页面,除非我在页面加载后再次单击组合框。但是,如果我将默认值保留在 (10,20,30) 中,则它可以正常工作。它将加载页面并仅显示 10 行,然后允许我转到下一页的其余行等。我需要将页面限制为 100 个结果而不是 10 个。为了测试,我试图将其更改为限制到 5 行,但它没有正确调整,直到我在页面加载后单击下拉菜单中的 5。这是我当前的代码。

HTML

<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="5">5</option>
        <option value="20">20</option>
        <option value="30">30</option>  
    </select>
</form>
</div>

javascript

<script>

$(document).ready(function() 
    { 
        $("#distributorTable").tablesorter({ headers: { 1:{sorter:false} } } );
        $("#distributorTable").tablesorterPager({container: $("#pager")}); 

    } 
);

</script>

【问题讨论】:

    标签: javascript jquery html pagination tablesorter


    【解决方案1】:

    我在发布此内容后立即找到了解决方案。您可以在使用分页功能时发送一个大小值,该功能将设置初始页面大小。

    Javascript

    $("#distributorTable").tablesorterPager({container: $("#pager"), size:5}); 
    

    【讨论】:

      猜你喜欢
      • 2011-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多