【发布时间】:2014-05-25 06:45:07
【问题描述】:
我有以下页脚表:
<tfoot>
<tr>
<th colspan="9">Total amount:</th>
<th></th>
<th></th>
</tr>
<tr>
<th colspan="9">Grand total:</th>
<th colspan="2"></th>
</tr>
</tfoot>
我正在使用 jQuery DataTable 来呈现来自 mySQL 的数据,并且我正在使用第一个页脚行来汇总表中两列中的值,比如说 Amount 和 SAmount
"fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
var nCells = nRow.getElementsByTagName('th');
nCells[0].innerHTML = Amount;
var nCells = nRow.getElementsByTagName('th');
nCells[1].innerHTML = SAmount;
});
在第二个页脚行中,我想插入总金额和 SAmount 之间的差额。 如何在第二个页脚行中插入差异总行?
【问题讨论】:
-
我自己找到的 var secondRow = $(nRow).next()[0]; var nCells = secondRow.getElementsByTagName('td');
标签: jquery mysql datatables