Tablesorter和Bootstrap不让我排序

时间:2013-03-04 21:04:54

标签: jquery twitter-bootstrap tablesorter

我遇到了tablesorter的问题。我将脚本添加到文档的头部,并确保更改我的表的ID,但它不会让我排序。

表格代码:

<table class="table tablesort" id="table1">
    <thead>  
      <tr>  
        <th>Summoner Name</th>     
        <th>Role</th>  
        <th>Type</th>  
        <th>Level</th>
        <th>Division</th>
        <th>Comment</th>
        <th>Posted</th>  
      </tr>
    </thead>  
    <tbody>  
      <?php
        $result = mysql_query("SELECT * FROM na");
        $time = floor((time()-'time') / 60);
        mysql_query("DELETE FROM na WHERE " . -'time'+time()>3600);
        while($row = mysql_fetch_array($result))
        {
        if($_SERVER['REMOTE_ADDR']==$row['ip']){
            echo "<script type='text/javascript'>
            $('#buttonop').attr('value', 'Delete Your Listing');
            $('#buttonopa').attr('href', 'delete.php');
            $('#buttonop').removeClass('btn btn-large btn-success').addClass('btnchange');
            </script>";
        }
        $time = floor((time()-$row['time']) / 60);
        {
        echo "<tr>";
        echo "<td>" . $row['summoner'] . "</td>";
        echo "<td>" . $row['role'] . "</td>";
        echo "<td>" . $row['type'] . "</td>";
        echo "<td>" . $row['level'] . "</td>";
        echo "<td>" . $row['division'] . "</td>";
        echo "<td style='width: 350px;'>" . $row['comment'] . "</td>";
        echo "<td>" . $time . " minute(s) ago </td>";
        echo "</tr>";
        }
        }
      ?>
    </tbody>  
</table>

分拣机代码:

$(document).ready(function() 
    { 
        $("#table1").tablesorter(); 
    } 
); 

1 个答案:

答案 0 :(得分:2)

您在粘贴的第一行上将您的类命名为“tablesort”而不是“tablesorter”。尝试将其更改为“tablesorter”,看看是否有效。