jQuery分页 [英] Jquery Pagination
本文介绍了jQuery分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尽最大努力通过从Packt学习Jquery 1.3本书"来学习jQuery.
I am trying my hardest to learn jQuery with the "Learning Jquery 1.3 Book from Packt".
我在信中遵循代码,但是我发现很难使代码正常工作.
I am following the code to the letter but I am finding it hard to get the code working.
我正在尝试使用以下代码进行简单的页面分页,但是我没有运气能告诉我原因并提供一些建议.
I am trying a simple Page Pagination with the following code but I am having no luck can any one tell me why and offer some advice.
谢谢.
$(document) .ready(function() {
$('table.paginated').each(function() {
var currentPage = 0;
var numberPage = 5;
var $table = $(this);
$table.find('thead tr').hide()
.slice(currentPage * numPerPage, (currentPage + 1) * numPerPage)
.show();
});
});
我的表格标签是:
<table id="tablesorter" class="tablesorter" border="0" cellpadding="0" cellspacing="1">
<thead>
<tr>
<th>Ref</th>
<th>Date</th>
<th>Company</th>
<th>Operator</th>
<th>Boxes</th>
<th>Network</th>
<th>Quote Accept</th>
<th>Term Accept</th>
<th>Credit Check</th>
<th>Expiry</th>
</tr>
</thead>
<tbody>
推荐答案
这似乎很明显,但是您是否加载了tablesorter和tablesorter分页器插件?
This may seem obvious, but have you loaded the tablesorter and tablesorter pager plugin?
<script type="text/javascript" src="/path/to/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="/path/to/jquery.tablesorter.pager.js"></script>
还是您不使用这些插件?我只是以为您来自表ID.
or are you not using these plugins? I just assumed you were from the table id.
这篇关于jQuery分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文