我正在使用 jquery datatables
来显示数据。
<table class="report-tbl table-bordered" cellspacing="0" width="100%" id="report-tbl">
<thead>
<tr>
<th></th>
<th><span contenteditable="">Side A</span></th>
<th><span contenteditable="">Sode B</span></th>
<th><span contenteditable="">Side C</span></th>
</tr>
</thead>
<tbody id="rowcontainer">
</tbody>
</table>
I want to happen is that when I click a button data-table will add a column 'Side D'.
你知道我该怎么做吗?原因基于我在谷歌中看到的内容。 jQuery 数据表
尚不支持添加/删除动态列。
谢谢你,
最佳答案
如果你正在使用任何 jquery 库,那么试试这个
$($("thead").find("tr")[0]).append("<th <span contenteditable="">Side D</span></th>");
关于javascript - 如何在数据表上添加动态列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25245190/