1
我開始用引導框架製作網站。現在我想包含一個表使用引導表從這個URL:示例代碼引導表錯誤
問題是這些例子不起作用我認爲問題是完成數據到表中。該代碼是這樣的:
<!DOCTYPE html>
<html>
<head>
<title>Check/Uncheck All in all page</title>
<meta charset="utf-8">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/bootstrap-table/src/bootstrap-table.css">
<link rel="stylesheet" href="assets/examples.css">
<script src="assets/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/bootstrap-table/src/bootstrap-table.js"></script>
<script src="ga.js"></script>
</head>
<body>
<div class="container">
<h1>Check/Uncheck All in all page(<a href="https://github.com/wenzhixin/bootstrap-table/issues/1167" target="_blank">#1167</a>).</h1>
<div class="toolbar">
<button id="checkAll" class="btn btn-default">Check All</button>
<button id="uncheckAll" class="btn btn-default">Uncheck All</button>
</div>
<table id="table"
data-toggle="table"
data-toolbar=".toolbar"
data-pagination="true"
data-maintain-selected="true"
data-url="data1.json">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</div>
<script>
var $table = $('#table');
$(function() {
$('#checkAll').click(function() {
$table.bootstrapTable('togglePagination').bootstrapTable('checkAll').bootstrapTable('togglePagination');
});
$('#uncheckAll').click(function() {
$table.bootstrapTable('togglePagination').bootstrapTable('uncheckAll').bootstrapTable('togglePagination');
});
});
</script>
</body>
</html>
我已經把正確的引導,引導表和jQuery,但我覺得現在的問題是數據,還有一個參數是這樣的:<data-url="data1.json">
,但是我沒有這個文件。目前的結果是:
和正確的結果:
,對不起,我很失落......
謝謝!
哪裏是要顯示的數據,做什麼錯誤,你有在控制檯中? – madalinivascu