other.html 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('其他操作')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="btn-group-sm" id="toolbar" role="group">
  9. <a class="btn btn-success" onclick="$.table.showColumn('userName')">
  10. <i class="fa fa-check"></i> 显示姓名
  11. </a>
  12. <a class="btn btn-danger" onclick="$.table.hideColumn('userName')">
  13. <i class="fa fa-close"></i> 隐藏姓名
  14. </a>
  15. <a class="btn btn-info" onclick="selectColumns()">
  16. <i class="fa fa-search"></i> 获取选中姓名
  17. </a>
  18. <a class="btn btn-warning" onclick="$.table.refresh()">
  19. <i class="fa fa-refresh"></i> 刷新
  20. </a>
  21. <a class="btn btn-danger" onclick="$.table.destroy()">
  22. <i class="fa fa-refresh"></i> 销毁
  23. </a>
  24. <a class="btn btn-primary" onclick="selectFirstColumns()">
  25. <i class="fa fa-search"></i> 获取选中首列值
  26. </a>
  27. </div>
  28. <div class="row">
  29. <div class="col-sm-12 select-table table-striped">
  30. <table id="bootstrap-table"></table>
  31. </div>
  32. </div>
  33. </div>
  34. <div th:include="include :: footer"></div>
  35. <script th:inline="javascript">
  36. var prefix = ctx + "demo/table";
  37. var datas = [[${@dict.getType('sys_normal_disable')}]];
  38. $(function() {
  39. var options = {
  40. url: prefix + "/list",
  41. showSearch: false,
  42. showRefresh: false,
  43. showToggle: false,
  44. showColumns: false,
  45. columns: [{
  46. checkbox: true
  47. },
  48. {
  49. field : 'userId',
  50. title : '用户ID'
  51. },
  52. {
  53. field : 'userCode',
  54. title : '用户编号'
  55. },
  56. {
  57. field : 'userName',
  58. title : '用户姓名'
  59. },
  60. {
  61. field : 'userPhone',
  62. title : '用户手机'
  63. },
  64. {
  65. field : 'userEmail',
  66. title : '用户邮箱'
  67. },
  68. {
  69. field : 'userBalance',
  70. title : '用户余额'
  71. },
  72. {
  73. field: 'status',
  74. title: '用户状态',
  75. align: 'center',
  76. formatter: function(value, row, index) {
  77. return $.table.selectDictLabel(datas, value);
  78. }
  79. },
  80. {
  81. title: '操作',
  82. align: 'center',
  83. formatter: function(value, row, index) {
  84. var actions = [];
  85. actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
  86. actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
  87. return actions.join('');
  88. }
  89. }]
  90. };
  91. $.table.init(options);
  92. });
  93. function selectColumns() {
  94. var column = $.table.selectColumns('userName');
  95. alert(column);
  96. }
  97. function selectFirstColumns() {
  98. var column = $.table.selectFirstColumns();
  99. alert(column);
  100. }
  101. </script>
  102. </body>
  103. </html>