官網:Bootstrap Ttable

文件:Introduction

GitHub:https://github.com/wenzhixin/bootstrap-table

安裝

  1. B5 框架

    <!doctype html>
    <html lang="en">
      <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    
        <!-- Bootstrap CSS -->
        <link href="<https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css>" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
        
        <!-- Bootstrap Bundle with Popper -->
        <script src="<https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js>" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
    
        <!-- jQuery -->
        <script src="<https://code.jquery.com/jquery-3.6.3.min.js>" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
    
        <title>xxx</title>
      </head>
      <body>
        <div class="container">
          <!-- 原始碼 -->
        </div>
      </body>
    </html>
    
  2. 引入套件

    <!-- 參考 <https://bootstrap-table.com/docs/getting-started/introduction/> -->
    <!-- 引入CSS -->
    <link rel="stylesheet" href="<https://unpkg.com/[email protected]/dist/bootstrap-table.min.css>">
    
    <!-- 引入JS -->
    <script src="<https://unpkg.com/[email protected]/dist/bootstrap-table.min.js>"></script>
    
  3. 啟始模版

    <!doctype html>
    <html lang="en">
      <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>Hello, Bootstrap Table!</title>
    
        <link href="<https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css>" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
        <link rel="stylesheet" href="<https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css>">
        <link rel="stylesheet" href="<https://unpkg.com/[email protected]/dist/bootstrap-table.min.css>">
      </head>
      <body>
        <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>
    
        <script src="<https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js>"></script>
        <script src="<https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js>" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
        <script src="<https://unpkg.com/[email protected]/dist/bootstrap-table.min.js>"></script>
      </body>
    </html>
    

Json

通過 JavaScript

範例