bootstrap-table方法之:resetView,重新加载表格视图,一般用于重设表格的高度和宽度

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
<!DOCTYPE html>
<html>
<head>
    <title>resetView</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">
    <style>
        .div-table {width: 600px;}
    </style>
    <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>resetView</h1>
        <p>
            Reset the bootstrap table view, for example reset the table height: <code>$table.bootstrapTable('resetView');</code>
        </p>
        <div id="toolbar">
            <button id="button" class="btn btn-default">Large and resetView</button>
            <button id="button2" class="btn btn-default">Small and resetView</button>
        </div>
        <div class="div-table">
            <table id="table"
                   data-toggle="table"
                   data-toolbar="#toolbar"
                   data-height="460"
                   data-url="../json/data1.json">
                <thead>
                <tr>
                    <th data-field="id">ID</th>
                    <th data-field="name">Item Name</th>
                    <th data-field="price">Item Price</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
<script>
    var $div = $('.div-table'),
        $table = $('#table'),
        $button = $('#button'),
        $button2 = $('#button2');
 
    $(function () {
        $button.click(function () {
            $div.width($div.width() + 50);
            $table.bootstrapTable('resetView');
        });
        $button2.click(function () {
            $div.width($div.width() - 50);
            $table.bootstrapTable('resetView');
        });
    });
</script>
</body>
</html>

  

posted on   itjeff  阅读(132)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2014-08-07 两个div横向排列,顶端对齐的方式。
2014-08-07 引用js或css后加?v= 版本号的用法

导航

< 2025年3月 >
23 24 25 26 27 28 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 1 2 3 4 5
点击右上角即可分享
微信分享提示