Bootstrap Table 使用教程基础篇 之 加载数据

  • A+
所属分类:Bootstrap Table

Bootstrap Table 使用教程基础篇 之 加载数据
通过 data 属性的方式。data-url="data1.json"

Html

  1. <div id="articles">  
  2.     <table id="table2"  
  3.             data-toggle="table"  
  4.             data-toolbar="#toolbar"  
  5.             data-search="true"  
  6.             data-show-refresh="true"  
  7.             data-show-toggle="true"  
  8.             data-show-columns="true"  
  9.             data-show-export="true"  
  10.             data-detail-view="true"  
  11.             data-detail-formatter="detailFormatter"  
  12.             data-minimum-count-columns="2"  
  13.             data-show-pagination-switch="true"  
  14.             data-pagination="true"  
  15.             data-page-list="[10, 25, 50, 100, ALL]"  
  16.             data-height="666"  
  17.             data-sort-name="ID"  
  18.             data-sort-order="desc"  
  19.             data-url="ZnmzTabeUrl">  
  20.         <thead>  
  21.             <tr>  
  22.                 <th data-field="数据库列名" data-sortable="true">系统ID</th>  
  23.                 <th data-field="数据库列名" data-formatter="dateFormatter" data-sortable="true">开始时间</th>  
  24.                 <th data-field="数据库列名" data-sortable="true">备注</th>  
  25.             </tr>  
  26.         </thead>  
  27.     </table>  
  28. </div>      

Controller

  1. Entities sql = new Entities();  
  2.         /// <summary>  
  3.         /// Table值  
  4.         /// </summary>  
  5.         /// <returns></returns>  
  6.         public JsonResult ZnmzTabeUrl()  
  7.         {  
  8.             var ZnmzTable = from sql in sql.表名  
  9.                            select sql;  
  10.             var data = ZnmzTable.ToList();  
  11.             return Json(data, JsonRequestBehavior.AllowGet);  
  12.         }  
钰玺

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: