jQuery数据表 - 通过排序连接子行

时间:2015-04-20 08:25:33

标签: javascript jquery sorting jquery-plugins datatable

我正在尝试执行以下操作,我有一个包含行的表,有些行在它们下面有行可以折叠。 (见下面的代码)

我正在使用脚本:http://datatables.net对表格进行排序。但是当我对它们进行排序时,总是需要在可见的下方的同一位置(按类或类别分组)

如何做到这一点?

<table id="table">
  <thead>
    <tr>
      <td>id</td>
      <td>actions</td>     
    </tr>
  </thead>
  <tbody>
    <tr class="group-1">
      <td>Row visible</td>
      <td><a href="#" class="collapse">COLLAPSE SUBROWS</a></td>
    </tr>
    <tr class="group-1" style="display: none;">
      <td>Row can be collapsed</td>
      <td>Row can be collapsed</td>
    <tr>
    <tr class="group-2">
      <td>Row visibile 2</td>
      <td>Row visibile 2</td>
    </tr>
  </tbody>
</table>

<script>
  var table = $('#table').DataTable();
</script>

0 个答案:

没有答案