2014-02-12 58 views
0

您好我正在使用jquery table sorter与pager.I有四个表和寻呼机每个。显示表和相应的寻呼机,同时单击按钮。同时单击第一个和第二个按钮,寻呼机的表工作正常。jquery tablesorter寻呼机不工作

但是,当点击第三个和第四个按钮时,我得到 以下错误“Uncaught TypeError:无法设置未定义的属性”窗口小部件“,传呼机无法正常工作。

Code called in OnLoad: 

    $("#tableTest").hide(); // Hide the table in onload 
    $("#tableTest").tablesorter(); // Trigger the tablesorter in onload 
    $("#tableTest").trigger("update"); // Trigger the update function for table in onload 
    $("#tableTest").tablesorterPager({ container: $("#pagerTest") }); // Trigger the pager for table in onload 


Code After displaying the table 
    $("#tableTest").trigger("update"); 
    $("#tableTest").data("tablesorter").widgets = ["zebra"]; 
    $("#tableTest").trigger('applyWidgets'); 
    $('header,body,html').animate({ scrollTop: $('header').height() }, 4); 

请指导我什么是问题,我在哪里wrong.Pager不正常工作的第三和第四表。

+0

你可以显示所有四个tablesm的代码,以及如何更新它们...对我来说,它听起来像一个表(而不是tbody的内容)正在被完全替换,并且tablesorter没有被重新初始化 - 'trigger(“update”)'只适用于tbody更新。 – Mottie

回答

0

显然,$("#tableTest").data("tablesorter")返回null。 你确定tablesorter在.data('tablesorter')中存储它的init数据吗?你使用哪种tablesorter插件(有几个)?

+0

我已经使用这个链接的示例代码[链接](https://www.novell.com/communities/coolsolutions/jquery-tablesorter-pagination-and-sorting-made-simple/),我无法理解你的关于初始化数据的问题 – user2247744

+0

自从至少版本2.0.5(在tablesorter.com),tablesorter一直在'.data('tablesorter')内存储'config'变量。 – Mottie