Repository navigation
Expand file tree
/
Copy path283.html
More file actions
87 lines (79 loc) · 1.78 KB
/
Copy path283.html
File metadata and controls
87 lines (79 loc) · 1.78 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
87
<script>
init({
title: 'Issue #283',
desc: 'Use resetView to reset the header width(<a href="https://github.com/wenzhixin/bootstrap-table/issues/283" target="_blank">#283</a>).',
links: ['bootstrap-table.min.css'],
scripts: ['bootstrap-table.min.js']
})
</script>
<style>
.div-table {
/*display: table;*/
border: 1px solid #ccc;
}
.cell-left {
/*display: table-cell;*/
float: left;
width:80%;
}
.cell-right {
/*display: table-cell;*/
float: right;
width:20%;
}
</style>
<p>
<button id="b" type="button" class="btn btn-secondary">Larger</button>
<button id="s" type="button" class="btn btn-secondary">Smaller</button>
</p>
<div id="d" class="div-table">
<div class="cell-left">
<table id="table" data-height="500"></table>
</div>
<div class="cell-right">
RRR
</div>
<div class="clearfix"></div>
</div>
<script>
var $table = $('#table')
function buildTable($el, cells, rows) {
var i
var j
var row
var columns = []
var 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)
}
$el.bootstrapTable('destroy').bootstrapTable({
columns: columns,
data: data
})
}
function mounted() {
buildTable($('#table'), 10, 50)
var $d = $('#d')
var width = $d.width()
$('#b').click(function() {
width += 100
$d.css('width', width + 'px')
$table.bootstrapTable('resetView')
})
$('#s').click(function() {
width -= 100
$d.css('width', width + 'px')
$table.bootstrapTable('resetView')
})
}
</script>