Reputation: 6292
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.
Thanks.
$(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();
});
});
My Table tabs are :
<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>
Upvotes: 0
Views: 1399
Reputation: 88846
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>
or are you not using these plugins? I just assumed you were from the table id.
Upvotes: 2
Reputation: 1206
First line
$(document) .ready(function() { // Bad Syntax
Remove that space!
$(document).ready(function() { // Good Syntax
Upvotes: 1
Reputation: 251262
Does your table definitely have the correct definition... i.e.
<table>
<tbody>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
<tr>...</tr>
</tbody>
</table>
The only problem that pops out at me is that it relies on the rows being nested in a tbody tag.
Upvotes: 0