123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Fixed Columns</title>
- <meta charset="utf-8">
- <link rel="stylesheet" href="http://www.kiivokms.net/css/bootstrap.min.css">
- <script src="http://www.kiivokms.net/assets/d5ce4d4c/libs/jquery/jquery-3.7.0.min.js"></script>
- <script src="http://www.kiivokms.net/assets/d5ce4d4c/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
- <link href="https://unpkg.com/bootstrap-table@1.20.2/dist/bootstrap-table.min.css" rel="stylesheet">
- <script src="https://unpkg.com/bootstrap-table@1.20.2/dist/bootstrap-table.min.js"></script>
- <link href="https://unpkg.com/bootstrap-table@1.20.2/dist/extensions/fixed-columns/bootstrap-table-fixed-columns.min.css" rel="stylesheet">
- <script src="https://unpkg.com/bootstrap-table@1.20.2/dist/extensions/fixed-columns/bootstrap-table-fixed-columns.min.js"></script>
- </head>
- <body>
- <div class="container">
- <h1>Fixed Columns</h1>
- <div class="toolbar form-inline">
- <span>Fixed Number: </span>
- <input class="form-control" id="fixedNumber" type="number" value="1" min="1" max="5">
- </div>
- <table id="table" data-height="400" data-show-columns="true"></table>
- </div>
- <script>
- var $table = $('#table');
- $(function () {
- buildTable($table, 20, 20);
- $('#fixedNumber').change(function () {
- buildTable($table, 20, 20);
- });
- });
- function buildTable($el, cells, rows) {
- var i, j, row,
- columns = [],
- data = [];
- for (i = 0; i < cells; i++) {
- columns.push({
- field: 'field' + i,
- title: 'Cell' + i,
- sortable: true
- });
- }
- for (i = 0; i < rows; i++) {
- row = {};
- for (j = 0; j < cells; j++) {
- row['field' + j] = 'Rows-' + i + '-' + j;
- }
- data.push(row);
- }
- $el.bootstrapTable('destroy').bootstrapTable({
- columns: columns,
- data: data,
- search: true,
- toolbar: '.toolbar',
- fixedColumns: true,
- fixedNumber: +$('#fixedNumber').val()
- });
- }
- </script>
- </body>
- </html>
|