javascript - 删除并重新填充 boostrapTable

标签 javascript jquery bootstrap-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');

关于javascript - 删除并重新填充 boostrapTable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44949235/

相关文章:

javascript - 在使用 vue-cli 3 (webpack 4.15.1) 启动的项目上关闭热重载

javascript - 如何删除jquery上附加的div

javascript - jQuery 检查按下的键是否可打印

javascript - 带有 Knockout JS 的文智信 Bootstrap-table

javascript - 引导表自定义搜索

javascript - 在javascript中定期调用函数直到完成,然后开始调用不同的函数

javascript - 带有日期字符串的 Angular orderBy

javascript - 如何在css3中将小圆圈添加到大圆圈中?

javascript - Ajax 调用使 Sprite 运动闪烁 javascript

javascript - 如何使 HTML 表格的 tbody 滚动?