|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <title>showColumn/hideCoulumn</title> |
| 5 | + <meta charset="utf-8"> |
| 6 | + <link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css"> |
| 7 | + <link rel="stylesheet" href="../assets/bootstrap-table/src/bootstrap-table.css"> |
| 8 | + <link rel="stylesheet" href="../assets/examples.css"> |
| 9 | + <script src="../assets/jquery.min.js"></script> |
| 10 | + <script src="../assets/bootstrap/js/bootstrap.min.js"></script> |
| 11 | + <script src="../assets/bootstrap-table/src/bootstrap-table.js"></script> |
| 12 | + <script src="../ga.js"></script> |
| 13 | +</head> |
| 14 | +<body> |
| 15 | + <div class="container"> |
| 16 | + <div class="ribbon"> |
| 17 | + <a href="https://github.com/wenzhixin/bootstrap-table-examples/blob/master/methods/showColumn-hideCoulumn.html" target="_blank">View Source on GitHub</a> |
| 18 | + </div> |
| 19 | + <h1>showColumn/hideCoulumn</h1> |
| 20 | + <p> |
| 21 | + Show/Hide the specified column.<br> |
| 22 | + <code>$table.bootstrapTable('showColumn', 'name');</code><br> |
| 23 | + <code>$table.bootstrapTable('hideColumn', 'name');</code> |
| 24 | + </p> |
| 25 | + <div id="toolbar"> |
| 26 | + <button id="button" class="btn btn-default">showColumn</button> |
| 27 | + <button id="button2" class="btn btn-default">hideCoulumn</button> |
| 28 | + </div> |
| 29 | + <table id="table" |
| 30 | + data-toggle="table" |
| 31 | + data-toolbar="#toolbar" |
| 32 | + data-height="460" |
| 33 | + data-url="../json/data1.json"> |
| 34 | + <thead> |
| 35 | + <tr> |
| 36 | + <th data-field="id">ID</th> |
| 37 | + <th data-field="name">Item Name</th> |
| 38 | + <th data-field="price">Item Price</th> |
| 39 | + </tr> |
| 40 | + </thead> |
| 41 | + </table> |
| 42 | + </div> |
| 43 | +<script> |
| 44 | + var $table = $('#table'), |
| 45 | + $button = $('#button'), |
| 46 | + $button2 = $('#button2'); |
| 47 | + |
| 48 | + $(function () { |
| 49 | + $button.click(function () { |
| 50 | + $table.bootstrapTable('showColumn', 'name'); |
| 51 | + }); |
| 52 | + $button2.click(function () { |
| 53 | + $table.bootstrapTable('hideColumn', 'name'); |
| 54 | + }); |
| 55 | + }); |
| 56 | +</script> |
| 57 | +</body> |
| 58 | +</html> |
0 commit comments