【问题标题】:tablesorter not sorting表格排序器不排序
【发布时间】:2013-03-24 10:47:49
【问题描述】:

很抱歉提出这个愚蠢的问题,但我已经挣扎了几个小时没有成功。 我的示例表没有被排序。两个 .js 文件都位于与 .shtml 文件本身相同的目录中。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript" src="jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() 
    { 
        $("#myTable").tablesorter(); 
    } 
); 
</script>
</head>
<body>
<table id="myTable" class="tablesorter">
   <thead>
     <tr>
     <th>Test1</th>
     <th>Test2</th>
    </tr>
   </thead>
   <tbody>
    <tr>
     <td>1</td>
     <td>1622</td>
    </tr>
    <tr>
     <td>2</td>
     <td>2634</td>
    </tr>
   </tbody>
</table>
</body>
</html>

【问题讨论】:

    标签: jquery tablesorter


    【解决方案1】:

    也许你有坏的 jquery 和 tablesorter 副本?使用从各自站点链接的 jquery 和 tablesorter 的实际版本对我来说似乎工作正常。

    http://code.jquery.com/jquery-1.9.1.js
    http://mottie.github.com/tablesorter/js/jquery.tablesorter.js

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
    <head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script type="text/javascript" src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script>
    <script type="text/javascript">
    $(document).ready(function() 
        { 
            $("#myTable").tablesorter(); 
        } 
    ); 
    </script>
    </head>
    <body>
    <table id="myTable" class="tablesorter">
       <thead>
         <tr>
         <th>Test1</th>
         <th>Test2</th>
        </tr>
       </thead>
       <tbody>
        <tr>
         <td>1</td>
         <td>1622</td>
        </tr>
        <tr>
         <td>2</td>
         <td>2634</td>
        </tr>
       </tbody>
    </table>
    </body>
    

    【讨论】:

    • 谢谢。恐怕必须存在一般配置问题。您提供的来源也不起作用...
    • 是的,那么不确定。这对我在 Chrome 和 IE8 上都有效,但我确实必须允许 IE8 中的脚本。
    • 一定要用this fork的tablesorter。它修复了原版的各种问题,现在已经好几年没有更新了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多