我基本上想刷新表中保存的数据。第一次实例化工作得很好,但在删除并重新获取数据后就没有运气了。
html
<table id="tablePendByOrg" class="table table-bordered table-hover table-condensed table-striped">
<thead>
<tr>
<th data-field="Date">Time</th>
<th data-field="Organization">Org</th>
<th data-field="f24hs"><24Hs</th>
<th data-field="f48Hs"><48Hs</th>
<th data-field="f48Hs">>48Hs</th>
<th data-field="fTotal">Total</th>
</tr>
</thead>
</table>
js
在 ajax 调用后填充。
$('#tablePendByOrg').bootstrapTable({
data: d.Table
});
js
删除数据
$("#tablePendByOrg tbody tr").remove();
在对ajax代码进行新调用后,我在d.Table
中获得了正确的数据,但页面上没有显示tbody
,仅显示了框架 >th
我从一开始就设置了。
最佳答案
正如他们所描述的:
$table = $('#tablePendByOrg');
$table.bootstrapTable('load', data); // removes old data, no need to remove it by yourself
此外,所有项目的删除也不能像您那样进行:
$("#tablePendByOrg tbody tr").remove();
用途:
$table.bootstrapTable('removeAll');
关于javascript - 删除并重新填充 boostrapTable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44949235/