var $table = $('#table');
var mydata =
\t [
\t \t {
\t \t \t "id": 0,
\t \t \t "name": "test0",
\t \t \t "price": "$0"
\t \t },
\t \t {
\t \t \t "id": 1,
\t \t \t "name": "test1",
\t \t \t "price": "$1"
\t \t },
\t \t {
\t \t \t "id": 2,
\t \t \t "name": "test2",
\t \t \t "price": "$2"
\t \t },
\t \t {
\t \t \t "id": 3,
\t \t \t "name": "test3",
\t \t \t "price": "$3"
\t \t },
\t \t {
\t \t \t "id": 4,
\t \t \t "name": "test4",
\t \t \t "price": "$4"
\t \t },
\t \t {
\t \t \t "id": 5,
\t \t \t "name": "test5",
\t \t \t "price": "$5"
\t \t },
\t \t {
\t \t \t "id": 6,
\t \t \t "name": "test6",
\t \t \t "price": "$6"
\t \t },
\t \t {
\t \t \t "id": 7,
\t \t \t "name": "test7",
\t \t \t "price": "$7"
\t \t },
\t \t {
\t \t \t "id": 8,
\t \t \t "name": "test8",
\t \t \t "price": "$8"
\t \t },
\t \t {
\t \t \t "id": 9,
\t \t \t "name": "test9",
\t \t \t "price": "$9"
\t \t },
\t \t {
\t \t \t "id": 10,
\t \t \t "name": "test10",
\t \t \t "price": "$10"
\t \t },
\t \t {
\t \t \t "id": 11,
\t \t \t "name": "test11",
\t \t \t "price": "$11"
\t \t },
\t \t {
\t \t \t "id": 12,
\t \t \t "name": "test12",
\t \t \t "price": "$12"
\t \t },
\t \t {
\t \t \t "id": 13,
\t \t \t "name": "test13",
\t \t \t "price": "$13"
\t \t },
\t \t {
\t \t \t "id": 14,
\t \t \t "name": "test14",
\t \t \t "price": "$14"
\t \t },
\t \t {
\t \t \t "id": 15,
\t \t \t "name": "test15",
\t \t \t "price": "$15"
\t \t },
\t \t {
\t \t \t "id": 16,
\t \t \t "name": "test16",
\t \t \t "price": "$16"
\t \t },
\t \t {
\t \t \t "id": 17,
\t \t \t "name": "test17",
\t \t \t "price": "$17"
\t \t },
\t \t {
\t \t \t "id": 18,
\t \t \t "name": "test18",
\t \t \t "price": "$18"
\t \t },
\t \t {
\t \t \t "id": 19,
\t \t \t "name": "test19",
\t \t \t "price": "$19"
\t \t },
\t \t {
\t \t \t "id": 20,
\t \t \t "name": "test20",
\t \t \t "price": "$20"
\t \t }
\t ];
$(function() {
\t $('#table').bootstrapTable({
\t \t data: mydata
\t });
\t //console.log(mydata);
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"/>
<link rel="stylesheet" href="https://rawgit.com/wenzhixin/bootstrap-table/master/dist/bootstrap-table.min.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://rawgit.com/wenzhixin/bootstrap-table/master/dist/bootstrap-table.min.js"></script>
<div class="container">
<table id="table">
<thead>
<tr>
<th data-field="id">Item ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</div>
你需要什麼?反正前請閱讀問你的問題https://stackoverflow.com/help/how-to-ask – core114
什麼錯誤/問題? –
使用datatables https://datatables.net/ – juntapao