如何在bootstrap表中添加自动生成的s.no列?

时间:2017-08-31 16:19:34

标签: javascript

以下是html供参考。目前S.No是硬编码的,但我希望脚本自动生成序列号递增1 ..请告诉我怎么做..

<html> 
  <head>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.css" rel="stylesheet" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.11.1/extensions/export/bootstrap-table-export.min.js"></script>
  </head>
  <body>
    <table data-toggle="table"
      data-search="true"
      data-show-refresh="true"
      data-show-toggle="true"
      data-show-columns="true"
      data-show-export="true"
      data-minimum-count-columns="2"
      data-show-pagination-switch="true"
      data-pagination="true"
      data-id-field="id"
      data-page-list="[10, 25, 50, 100, ALL]"
      data-show-footer="false"
      data-side-pagination="client"
      data-url="https://jsonplaceholder.typicode.com/photos">
      <thead>
        <tr>
          <th data-field="id">Id</th>
          <th data-field="title">Title</th>
          <th data-field="url">URL</th>
          <th data-field="thumbnailUrl">Thumbnail URL</th>
        </tr>
      </thead>
  </body>     
</html>

0 个答案:

没有答案