_006_Bootstrap_dataTable定时刷新数据

来自于https://blog.csdn.net/zxf1242652895/article/details/73469257,感谢作者的无私分享。

[html]  view plain  copy
  1. <div class="col-lg-12 col-md-12 col-xs-12">  
  2.                    <div class="x_content">  
  3.                         <div class="row top_tiles">  
  4.                          <table id="machkanbandataTable" class="col-md-12 col-sm-12 col-xs-12">  
  5.                                     <thead>  
  6.                                        <tr>  
  7.                                           <th></th>  
  8.                                        </tr>  
  9.                                     </thead>  
  10.                                     <tbody id="machkanbanContent"  class="">  
  11.                                            
  12.                                     </tbody>  
  13.                                 </table>  
  14.                            </div>  
  15.                    </div>  
  16.             </div>  

[javascript]  view plain  copy
  1. var tables;  
  2.          $(document).ready(function(){  
  3.             createTable();  
  4.           });   
  5.            
  6.          function machKanbanMethod1233(){   
  7.              tables.destroy();//销毁原先的table  
  8.              createTable();  
  9.          }   
  10.          function createTable(){  
  11.               var code='';  
  12.               var machCode='';  
  13.               $.ajax({  
  14.                     
  15.                            //代码部分........  
  16.                    
  17.               });     
  18.              tables=  $('#machkanbandataTable').DataTable( {  
  19.                     destroy:true,  
  20.                     "bSort"false,//禁止分页  
  21.                     "iDisplayLength": 25, //jquery datatable默认每页显示多少条数据  
  22.                     language: {  
  23.                         "sProcessing""处理中...",  
  24.                         "sLengthMenu""显示 _MENU_ 台结果",  
  25.                         "sZeroRecords""没有匹配结果",  
  26.                         "sInfo""显示第 _START_ 至 _END_ 台,共 _TOTAL_ 台",  
  27.                         "sInfoEmpty""显示第 0 至 0 台结果,共 0 台",  
  28.                         "sInfoFiltered""(由 _MAX_ 台结果过滤)",  
  29.                         "sInfoPostFix""",  
  30.                         "sSearch""查询:",  
  31.                         "sUrl""",  
  32.                         "sEmptyTable""数据为空",  
  33.                         "sLoadingRecords""载入中...",  
  34.                         "sInfoThousands"",",  
  35.                         "oPaginate": {  
  36.                             "sFirst""首页",  
  37.                             "sPrevious""上页",  
  38.                             "sNext""下页",  
  39.                             "sLast""末页"  
  40.                         },  
  41.                         "oAria": {  
  42.                             "sSortAscending"": 以升序排列此列",  
  43.                             "sSortDescending"": 以降序排列此列"  
  44.                         }  
  45.                     }  
  46.                 } )  
  47.             timeouts.push(setTimeout("machKanbanMethod1233()",10000))//注十秒刷新数据  
  48.         }  

猜你喜欢

转载自blog.csdn.net/poiuyppp/article/details/80721157