码迷,mamicode.com
首页 > 其他好文 > 详细

Bootstrap Table 查询(服务器端)、刷新数据

时间:2018-01-19 11:33:32      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:str   sse   例子   res   tag   分享图片   field   efault   option   

Refresh from url after use data option

 

[html] view plain copy
 
  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.     <title>Refresh from url after use data option</title>  
  5.     <meta charset="utf-8">  
  6.     <link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">  
  7.     <link rel="stylesheet" href="../assets/bootstrap-table/src/bootstrap-table.css">  
  8.     <link rel="stylesheet" href="../assets/examples.css">  
  9.     <script src="../assets/jquery.min.js"></script>  
  10.     <script src="../assets/bootstrap/js/bootstrap.min.js"></script>  
  11.     <script src="../assets/bootstrap-table/src/bootstrap-table.js"></script>  
  12.     <script src="../ga.js"></script>  
  13. </head>  
  14. <body>  
  15. <div class="container">  
  16.     <h1>Refresh from url after use data option(<href="https://github.com/wenzhixin/bootstrap-table/issues/137" target="_blank">#137</a>).</h1>  
  17.     <p><button id="button" class="btn btn-default">Refresh from url</button></p>  
  18.     <table id="table">  
  19.         <thead>  
  20.         <tr>  
  21.             <th data-field="id">ID</th>  
  22.             <th data-field="name">Item Name</th>  
  23.             <th data-field="price">Item Price</th>  
  24.         </tr>  
  25.         </thead>  
  26.     </table>  
  27. </div>  
  28. <script>  
  29.     var $table = $(‘#table‘);  
  30.     $(function () {  
  31.         $table.bootstrapTable({  
  32.             data: [{  
  33.                 "id": 0,  
  34.                 "name": "Item 0",  
  35.                 "price": "$0"  
  36.             }]  
  37.         });  
  38.         $(‘#button‘).click(function () {  
  39.             $table.bootstrapTable(‘refresh‘, {url: ‘../json/data1.json‘});  
  40.         });  
  41.     });  
  42. </script>  
  43. </body>  
  44. </html>  


效果图:

 

技术分享图片

点击按钮后,table表格数据变化如下:技术分享图片

 

 

 

转自:

http://issues.wenzhixin.net.cn/bootstrap-table/#issues/137.html

源码

https://github.com/wenzhixin/bootstrap-table-examples/blob/master/issues/137.html

例子们:

http://bootstrap-table.wenzhixin.net.cn/examples/

Bootstrap Table 查询(服务器端)、刷新数据

标签:str   sse   例子   res   tag   分享图片   field   efault   option   

原文地址:https://www.cnblogs.com/xiaoleiel/p/8315316.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!