dataTable定時重新整理資料
阿新 • • 發佈:2019-02-05
<div class="col-lg-12 col-md-12 col-xs-12"> <div class="x_content"> <div class="row top_tiles"> <table id="machkanbandataTable" class="col-md-12 col-sm-12 col-xs-12"> <thead> <tr> <th></th> </tr> </thead> <tbody id="machkanbanContent" class=""> </tbody> </table> </div> </div> </div>
var tables; $(document).ready(function(){ createTable(); }); function machKanbanMethod1233(){ tables.destroy();//銷燬原先的table createTable(); } function createTable(){ var code=''; var machCode=''; $.ajax({ //程式碼部分........ }); tables= $('#machkanbandataTable').DataTable( { destroy:true, "bSort": false,//禁止分頁 "iDisplayLength": 25, //jquery datatable預設每頁顯示多少條資料 language: { "sProcessing": "處理中...", "sLengthMenu": "顯示 _MENU_ 臺結果", "sZeroRecords": "沒有匹配結果", "sInfo": "顯示第 _START_ 至 _END_ 臺,共 _TOTAL_ 臺", "sInfoEmpty": "顯示第 0 至 0 臺結果,共 0 臺", "sInfoFiltered": "(由 _MAX_ 臺結果過濾)", "sInfoPostFix": "", "sSearch": "查詢:", "sUrl": "", "sEmptyTable": "資料為空", "sLoadingRecords": "載入中...", "sInfoThousands": ",", "oPaginate": { "sFirst": "首頁", "sPrevious": "上頁", "sNext": "下頁", "sLast": "末頁" }, "oAria": { "sSortAscending": ": 以升序排列此列", "sSortDescending": ": 以降序排列此列" } } } ) timeouts.push(setTimeout("machKanbanMethod1233()",10000))//注十秒重新整理資料 }