bootstrap如何动态绑定数据

2025年02月10日 建站教程

bootstrap如何动态绑定数据,下面web建站小编给大家详细介绍一下具体代码!

table表格绑定动态数据

<table
  data-toggle="table"
  data-url="data.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>

javaScript绑定数据

<table id="table"></table>
<script>
$('#table').bootstrapTable({
  url: 'data.json',
  pagination: true,
  search: true
  columns: [{
    field: 'id',
    title: 'Item ID'
  }, {
    field: 'name',
    title: 'Item Name'
  }, {
    field: 'price',
    title: 'Item Price'
  }, ]
})
</script>

本文链接:http://so.lmcjl.com/news/22902/

展开阅读全文
相关内容