Repository navigation
Expand file tree
/
Copy pathtest.html
More file actions
86 lines (83 loc) · 2.75 KB
/
Copy pathtest.html
File metadata and controls
86 lines (83 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test · Bootstrap Table</title>
<meta name="author" content="zhixin">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<!--<link rel="stylesheet" href="assets/bootstrap2.3/css/bootstrap.min.css">-->
<!--<link rel="stylesheet" href="assets/bootstrap2.3/css/bootstrap-responsive.min.css">-->
<link rel="stylesheet" href="../src/bootstrap-table.css">
</head>
<body>
<div class="container">
<div>
<label>Cells: </label><input id="cells" type="text" placeholder="Cells" value="5">
<label>Rows: </label><input id="rows" type="text" placeholder="Rows" value="100">
<button id="build" class="btn btn-default">Build</button>
</div>
<table id="table"
data-toggle="table"
data-url="data1.json"
data-show-columns="true"
data-search="true"
data-show-refresh="true"
data-show-toggle="true"
data-pagination="true"
data-height="500">
<thead>
<tr>
<th data-field="id" data-formatter="idFormatter">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</div>
<script src="assets/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<!--<script src="assets/bootstrap2.3/js/bootstrap.min.js"></script>-->
<script src="assets/table-export/tableExport.js"></script>
<script src="assets/table-export/jquery.base64.js"></script>
<script src="../src/bootstrap-table.js"></script>
<script src="../src/extensions/export/bootstrap-table-export.js"></script>
<script>
$(function () {
$('#build').click(build);//.trigger('click');
$('#cells, #rows').keyup(function (e) {
if (e.keyCode === 13) {
build();
}
});
});
function build() {
var cells = $('#cells').val(),
rows = $('#rows').val(),
i, j, row,
columns = [],
data = [];
for (i = 0; i < cells; i++) {
columns.push({
field: 'field' + i,
title: 'Cell' + i
});
}
for (i = 0; i < rows; i++) {
row = {};
for (j = 0; j < cells; j++) {
row['field' + j] = 'Row-' + i + '-' + j;
}
data.push(row);
}
$('#table').bootstrapTable('destroy').bootstrapTable({
columns: columns,
data: data
});
}
function idFormatter(value) {
return value + 100;
}
</script>
</body>
</html>