我正在尝试显示一个spinner元素,而bootstrap表每10秒默默刷新一次,但我遇到的问题是它不会同步运行并在显示后立即关闭微调器。 / p>
任何帮助都会一如既往地受到赞赏。
致电代码......
setInterval(function () {
$('#refreshing-running').show();
refreshRunningTable(function() {
$('#refreshing-running').hide(500);
});
}, 10000);
刷新方法......
function refreshRunningTable(callback) {
$('#running-table').bootstrapTable('refresh', { silent: true }); // this line needs to be synchronous and not callback until complete..
callback();
}
如果初始表设置有帮助......
function loadTable() {
$('#running-table')
.bootstrapTable({
method: 'get',
url: '/.../...',
striped: false,
pagination: true,
detailView: true,
detailFormatter: rowDetailFormatter,
pageSize: 5,
pageList: [4, 8, 16],
search: false,
showRefresh: false,
onResetView: function () { bindDeleteButtons() },
columns: [
{ width: '', field: 'a', title: 'a', sortable: true, formatter: aFormatter },
{ width: '', field: 'b', title: 'b', sortable: true },
{ width: '', field: 'c', title: 'c', sortable: true },
{ width: '', field: 'd', title: 'd', sortable: true }
]
});
}