【问题标题】:Bootstrap accordion + DataTables引导手风琴+数据表
【发布时间】:2014-05-22 02:39:10
【问题描述】:

我正在为我的表使用bootstrap 3 accordionDataTables,但我似乎无法在 Bootstrap 手风琴内初始化 DataTables

假设下表在 bootstrap 手风琴内

<table class="table table-bordered table-hover" class="materialTable">
<thead>
   <tr>
     <th>#</th>
     <th>Test</th>
   </tr>
</thead>
<tbody>
   <tr>
     <td>#</td>
     <td>Test</td>
   </tr>
</tbody>
</table>

这是我尝试初始化表格的方式

$( function () {
    $('.materialTable').dataTable({
        "aoColumnDefs": [{ "sClass": "text-center", "aTargets": [ 0,8 ] },
                         { 'bSortable': false, 'aTargets': [ 8 ] }],
    });
});

但是没有用。

【问题讨论】:

    标签: jquery twitter-bootstrap datatable


    【解决方案1】:
     <table class="table table-bordered table-hover materialTable">
    

    类属性声明了两次覆盖第二个属性

    【讨论】:

    • 我用了class,因为表不止一张。如果我使用 ID,以后处理表格会更复杂。
    • 您可以使用 class 但只有在添加此属性后才能在 html 中使用。您在一个标签中添加了两次。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-01
    • 2018-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-03
    • 1970-01-01
    相关资源
    最近更新 更多