bootstraptable需要徹底重新加載,發現即使url等參數更新過來仍舊無效。需要調用
$("#resource_table").bootstrapTable('destroy');
方法,將原表格銷毀,再重新init()初始化一次即可。
//點擊抽檢按鈕進行提交
$("#SpotCheckSubmit").click(function () {
//alert("12");
//alert($("#empAddModal form").serialize());
$.ajax({
url: "/BillsCheck/SpotCheck",
type: "POST",
data: $("#empAddModal form").serialize(),
success: function (result) {
if (result.flag===true) {
//成功
$("#empAddModal").modal("hide");
$('#empAddModal').on('hidden.bs.modal', function (e) {
$("#table_server").bootstrapTable('destroy');
var oTable = new TableInit();
oTable.Init("table_server", "/BillsCheck/GetSpotList", "/BillsCheck/GetChildrenList", colsParent, colsChild,"CreateTime","GoodsCode",true);
})
} else {
//失敗,顯示失敗信息
}
}
});
});
});
直接刷新
$("#table_server").bootstrapTable('refresh');