0

请参阅呈现页面http://pub.admc.com/tmp/trivial.html。 您可以看到,我从CDN获取jQuery,Bootstrap和Bootstrap,分别按照相应产品文档中的说明进行操作。无法排序的平凡'Bootstrap Table'(粘贴自文档)

看来,所有3种产品加载成功。如果我更改为从JSON加载表数据,那么JSON将成功填充表骨架,但仍不可排序。 Chrome浏览器JavaScript控制台运行100%清洁。

按照doc reference table(唯一的一种文档中存在的自举表:(),自举tablified表应该是默认的排序。不过我加了属性数据排序=真实的,但有没有效果。

<!DOCTYPE html> 
<html lang="en"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Bootstrap Table samples</title> 
    <meta charset="utf-8"> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.0/bootstrap-table.min.js"></script> 
<body> 
<table data-toggle="table"> 
    <thead> 
     <tr> 
      <th>Item ID</th> 
      <th>Item Name</th> 
      <th>Item Price</th> 
     </tr> 
    </thead> 
    <tbody> 
     <tr> 
      <td>1</td> 
      <td>Item 1</td> 
      <td>$1</td> 
     </tr> 
     <tr> 
      <td>2</td> 
      <td>Item 2</td> 
      <td>$2</td> 
     </tr> 
    </tbody> 
</table> 
</body> 
</html> 

回答

0

我想通了,虽然表元素默认为data-sortable=true,简直可以用,因为所有列默认sortable=false默认排序。

随着默认状态一切,你启动排序列逐列加attr data-sortable=trueth元素。