title: Jquery Table Pagination
body: <p>i ve the following code for pagination of table using jquery</p>
  
  <pre><code>$('table.producttable').each(function() {
      var currentPage = 0,
          numPerPage = 3,
          $table = $(this);
  
      $table.bind('repaginate', function() {
          $table.find('tbody tr').hide().slice(currentPage * numPerPage, (currentPage + 1) * numPerPage).show();
      });
  
      $table.trigger('repaginate');
  
      var numRows = $table.find('tbody tr').length,
          numPages = Math.ceil(numRows / numPerPage),
          $pager = $('&lt;div class="pagination"&gt;&lt;/div&gt;');
  
      for (var page = 0; page &lt; numPages; page++) {
  
          $('&lt;span class="page-number"&gt;&lt;/span&gt;')
              .text(page + 1)
              .bind('click', { newPage: page}, function(event) {
  
                  currentPage = event.data['newPage'];
                  $table.trigger('repaginate');
                  $(this).addClass('active').siblings().removeClass('active');
              })
              .appendTo($pager)
              .addClass('clickable');
  
      }
      $pager.insertAfter($table).find('span.page-number:first').addClass('active');
  });
  </code></pre>
  
  <p>but the code doesnot output "next" and "previous" buttons..also paginates even if there is only one page...anyone who has a better code or can find solution to this plzz help </p>