这是我的代码:
oTable2 = $('#BigData2').dataTable({
"bLengthChange":false,
"bPaginate":false,
"oLanguage": {
"sZeroRecords": "No records found"
},
"sAjaxSource":'StatusSrv',
// "sDom":'RCT<"clear">lfrtip',
//"aoColumnDefs":[{}]
})
var auto_refresh = setInterval(
function (){
$('#Status_Table').fadeOut('slow').load('SupplyPlanning.jsp
#oTable2.fnDraw()').fadeIn("slow");
}, 6000);
<div id="Status_Table" class="chartFloatLeftInner">
<table id="BigData2" >
<thead >
<tr>
<th><input type="checkbox" onClick="checkall()" name="maincheck" id="maincheck"/></th>
<th title="REQ_NO">REQ_NO</th>
<th title="Retailer Partner number">Retailer num</th>
<th title="STATUS">OVERALL_STATUS</th>
</tr>
</thead>
<tbody></tbody>
</table>
我想在特定的时间间隔刷新我的数据表,以便我使用fndraw
,但它仅使用旧数据重新绘制表格。如果我在数据库中插入新数据,则刷新后不会显示新数据;它仅显示旧数据。
最佳答案
您可能需要将 "bDestroy": true
属性添加到数据表代码中,以允许您重建它,否则一旦创建,您将无法使用新数据加载它。
关于javascript - 如何使用 JavaScript 刷新 div 内的数据表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21179369/