删除并重新填充引导程序表

removing and re-populating boostrapTable

我基本上想刷新 table 中保存的数据。第一次实例化工作得很好,但在删除和重新获取数据后就没有运气了。

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');