bootstrap-table 列中缺少排序按钮,页面列表未选择table
bootstrap-table missing sort button in column and pagelist not selectable
bootstrap table 不显示排序图标和页面列表 select 即使有页面列表,选项也只列出 1 个页面大小。
下面是导入的库:
<script src="PLUGINS/jquery-3.4.1.min.js"></script>
<script src="PLUGINS/jquery-migrate-3.0.1.min.js"></script>
<link rel="stylesheet" href="PLUGINS/bootstrap.min.css">
<script src="PLUGINS/bootstrap.min.js"></script>
<link rel="stylesheet" href="PLUGINS/bootstrap-table.min.css">
<script src="PLUGINS/bootstrap-table.min.js"></script>
<table id="userListTable" style="width:100%">
<thead>
<tr>
<th data-field="firstName">First Name</th>
<th data-field="lastName">Last Name</th>
<th data-field="userName">User Name</th>
</tr>
</thead>
</table>
$(document).ready(function() {
$('#userListTable').bootstrapTable({
pagination: true,
search: true,
sidePagination: 'server',
pageSize: 5,
pageList: [5, 10, 50, 100, 200],
showButtonIcons: true,
url: 'test.jsp'
});
} );
阅读 bootstrap-table 文档 https://bootstrap-table.com/docs/api/table-options/#pagination。 ,尝试通过数据属性设置你的 table 道具。检查您是否使用兼容的最新 js 库(bootstrap,等)
<!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 rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
</head>
<body>
<table data-toggle="table" data-page-size="1" data-pagination="true" data-page-list="[1,2,5]">
<thead>
<tr>
<th data-sortable="true">Item ID</th>
<th data-sortable="true">Item Name</th>
<th data-sortable="true">Item Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Item 2</td>
<td></td>
</tr>
</tbody>
</table>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
</body>
</html>
bootstrap table 不显示排序图标和页面列表 select 即使有页面列表,选项也只列出 1 个页面大小。
下面是导入的库:
<script src="PLUGINS/jquery-3.4.1.min.js"></script>
<script src="PLUGINS/jquery-migrate-3.0.1.min.js"></script>
<link rel="stylesheet" href="PLUGINS/bootstrap.min.css">
<script src="PLUGINS/bootstrap.min.js"></script>
<link rel="stylesheet" href="PLUGINS/bootstrap-table.min.css">
<script src="PLUGINS/bootstrap-table.min.js"></script>
<table id="userListTable" style="width:100%">
<thead>
<tr>
<th data-field="firstName">First Name</th>
<th data-field="lastName">Last Name</th>
<th data-field="userName">User Name</th>
</tr>
</thead>
</table>
$(document).ready(function() {
$('#userListTable').bootstrapTable({
pagination: true,
search: true,
sidePagination: 'server',
pageSize: 5,
pageList: [5, 10, 50, 100, 200],
showButtonIcons: true,
url: 'test.jsp'
});
} );
阅读 bootstrap-table 文档 https://bootstrap-table.com/docs/api/table-options/#pagination。 ,尝试通过数据属性设置你的 table 道具。检查您是否使用兼容的最新 js 库(bootstrap,等)
<!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 rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
</head>
<body>
<table data-toggle="table" data-page-size="1" data-pagination="true" data-page-list="[1,2,5]">
<thead>
<tr>
<th data-sortable="true">Item ID</th>
<th data-sortable="true">Item Name</th>
<th data-sortable="true">Item Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>1</td>
<td>Item 1</td>
<td></td>
</tr>
<tr>
<td>2</td>
<td>Item 2</td>
<td></td>
</tr>
</tbody>
</table>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
</body>
</html>