【发布时间】:2015-02-02 03:15:42
【问题描述】:
每当我使用<td colspan="x"></td> 时,我都会收到以下错误:
未捕获的类型错误:无法设置未定义(…)的属性“_DT_CellIndex”
演示
$("table").DataTable({});
<link href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/css/jquery.dataTables.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.12/js/jquery.dataTables.min.js"></script>
<table style="width:50%;">
<thead>
<tr>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>1</td>
<td colspan="2">3 4</td>
<td colspan="3">4 5 6</td>
</tr>
</tbody>
</table>
在没有 DataTables.js 的情况下它可以正常工作,但是当我们将此结构与 datatable.js 一起使用时,它就无法正常工作。我们需要上表结构。有谁知道我们如何使用这个表结构 datatable.js?
【问题讨论】:
-
目前,数据表不支持行跨度或列跨度到表体。 Reference 但是,可能的解决方案应该是 DataTables hidden row details example 希望它有效。
-
我已经给出了代码,请查看以下网址stackoverflow.com/questions/32088676/…
标签: javascript jquery datatables