[英]How can I refresh a datatable inside a div using JavaScript?
这是我的代码:
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
但它仅使用旧数据重新fndraw
表。 如果我在数据库中插入新数据,则刷新后不会显示新数据。 它仅显示旧数据。
可能需要在数据表代码中添加"bDestroy": true
属性,以便您可以重建它,否则一旦创建就无法将其与新数据一起加载。
尝试使用附加:
$('#Status_Table').append( your table in here);
对我有用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.