您好,欢迎访问一九零五行业门户网

bootstrap table 怎么绑定数据

支持三种方式bootstrap table绑定数据:1.html格式数据(即静态数据);2.javascript传递数据;3.数据属性变量动态获取。
静态表格:data-toggle=table(推荐学习:bootstrap视频教程)
<table data-toggle="table">  <thead>    <tr>      <th>item id</th>      <th>item name</th>      <th>item price</th>    </tr>  </thead>  <tbody>    <tr>      <td>1</td>      <td>item 1</td>      <td>$1</td>    </tr>    <tr>      <td>2</td>      <td>item 2</td>      <td>$2</td>    </tr>  </tbody></table>
javascript方式
<table id="table"></table><!--定义一个表格,无需设置表头,统一在js中初始化,灵活度较高(梁新建议)--><script>$('#table').bootstraptable({  url: 'data1.json',  pagination: true,  search: true  columns: [{    field: 'id',    title: 'item id'  }, {    field: 'name',    title: 'item name'  }, {    field: 'price',    title: 'item price'  }, ]})</script>
数据属性变量动态获取
<table data-toggle="table" data-url="data1.json" data-pagination="true" data-search="true">  <thead>    <tr>      <th data-sortable="true" data-field="id">item id</th>      <th data-field="name">item name</th>      <th data-field="price">item price</th>    </tr>  </thead></table>
更多bootstrap相关技术文章,请访问bootstrap教程栏目进行学习!
以上就是bootstrap table 怎么绑定数据的详细内容。
其它类似信息

推荐信息