开发者

Tablesorter and Pager: how to install?

开发者 https://www.devze.com 2023-01-07 05:51 出处:网络
I have my tablesorter with zebra up and running just fine but I can\'t seem to install the pager properly.

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>


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消