我正在使用Datatables,并且在中有这个元素。
<tr class="gradeA even row_selected" id="3692">
<td class=" sorting_1">3692</td>
<td class="">koza</td>
<td class="" title="10:12:30">2013-12-31</td>
<td class="">2014-02-06</td>
<td class="">FULL packet</td>
<td class="">NONE</td>
<td class="">Name</td>
</tr>
我想使用fnUpdate
函数更新第1个和第4个td
元素。我尝试仅更新一个td
,但它没有更新。
在Chrome中,控制台日志显示以下错误:
Uncaught TypeError: Cannot set property '_aData' of undefined
这是我尝试过的:
// dynamically update row
$('#example').dataTable().fnUpdate( ['Zebra'], parseInt('3692'));
3692
是需要更新的行的td
元素的ID,zebra
是需要更改的值。我知道我没有包括要更新哪个单元格,但我不知道如何做到这一点。在datatables api中,给出了以下示例:
oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1 ); // Row
plus 1
forsecond parameter will be the row, and the third is the column.
- Kishor Pawar