resizable.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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="row">
  9. <div class="col-sm-12 select-table table-bordered">
  10. <table id="bootstrap-table" data-resizable="true"></table>
  11. </div>
  12. </div>
  13. </div>
  14. <div th:include="include :: footer"></div>
  15. <th:block th:include="include :: bootstrap-table-resizable-js" />
  16. <script th:inline="javascript">
  17. var prefix = ctx + "demo/table";
  18. var datas = [[${@dict.getType('sys_normal_disable')}]];
  19. $(function() {
  20. var options = {
  21. url: prefix + "/list",
  22. showSearch: false,
  23. showRefresh: false,
  24. showToggle: false,
  25. showColumns: false,
  26. columns: [{
  27. checkbox: true
  28. },
  29. {
  30. field : 'userId',
  31. title : '用户ID'
  32. },
  33. {
  34. field : 'userCode',
  35. title : '用户编号'
  36. },
  37. {
  38. field : 'userName',
  39. title : '用户姓名',
  40. cellStyle: function (value, row, index) {
  41. return { css: { "min-width": "100px", "white-space": "nowrap", "text-overflow": "ellipsis", "overflow": "hidden", "max-width": "200px" } }
  42. },
  43. formatter: function(value, row, index) {
  44. if (index == 0) {
  45. value = value + ",测试用户姓名,这是一条长文本,可以通过拖拽自适应内容显示。。。。";
  46. }
  47. return $.table.tooltip(value, 30, "open");
  48. }
  49. },
  50. {
  51. field : 'userPhone',
  52. title : '用户手机'
  53. },
  54. {
  55. field : 'userEmail',
  56. title : '用户邮箱'
  57. },
  58. {
  59. field : 'userBalance',
  60. title : '用户余额'
  61. },
  62. {
  63. field: 'status',
  64. title: '用户状态',
  65. align: 'center',
  66. formatter: function(value, row, index) {
  67. return $.table.selectDictLabel(datas, value);
  68. }
  69. },
  70. {
  71. title: '操作',
  72. align: 'center',
  73. formatter: function(value, row, index) {
  74. var actions = [];
  75. actions.push('<a class="btn btn-success btn-xs" href="javascript:;"><i class="fa fa-edit"></i>编辑</a> ');
  76. actions.push('<a class="btn btn-danger btn-xs" href="javascript:;"><i class="fa fa-remove"></i>删除</a>');
  77. return actions.join('');
  78. }
  79. }]
  80. };
  81. $.table.init(options);
  82. });
  83. </script>
  84. </body>
  85. </html>