views:

46

answers:

1

I have my tablesorter with zebra up and running just fine but I can't seem to install the pager properly.

When I include the pager.js file like you see below, it breaks my sorting all together. The sorting works fine when this file is not loaded but I get no pager.

Someone, what am I doing wrong?

<script type="text/javascript" src="/site_media/jquery.js"></script>
<script type="text/javascript" src="/site_media/tablesorter/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="/site_media/tablesorter/jquery.tablesorter.pager.js"></script>

<script type="text/javascript">
$(document).ready(function() {
 // results table sorting
 $("#results")
 .tablesorter({widgets: ['zebra']})
 .tablesorterPager({container: $("#pager")
                                }); 

}); 
</script>
A: 

What you put as code should work.

    $("#"+tableid)
        .tablesorter({widthFixed: true, widgets: ['zebra']})
        .tablesorterPager({container: $("#pager")});

Make sure -

  1. You have your table with the same 'id' and pager container with same 'id'!
  2. Also sometimes javascript might be running before the table is completely rendered. So put javascripts at the end of the page.

Hope this helps...

MovieYoda