reorderRows.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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-striped">
  10. <p class="select-title">按住表格行拖拽</p>
  11. <table id="bootstrap-table"
  12. data-use-row-attr-func="true"
  13. data-reorderable-rows="true"></table>
  14. </div>
  15. </div>
  16. </div>
  17. <div th:include="include :: footer"></div>
  18. <th:block th:include="include :: bootstrap-table-reorder-rows-js" />
  19. <script th:inline="javascript">
  20. var prefix = ctx + "demo/table";
  21. var datas = [[${@dict.getType('sys_normal_disable')}]];
  22. $(function() {
  23. var options = {
  24. url: prefix + "/list",
  25. showSearch: false,
  26. showRefresh: false,
  27. showToggle: false,
  28. showColumns: false,
  29. onReorderRow: function (data) {
  30. //当拖拽结束后,data为整个表格的数据
  31. console.log('拖拽结束' + JSON.stringify(data))
  32. return false;
  33. },
  34. columns: [{
  35. checkbox: true
  36. },
  37. {
  38. field : 'userId',
  39. title : '用户ID'
  40. },
  41. {
  42. field : 'userCode',
  43. title : '用户编号'
  44. },
  45. {
  46. field : 'userName',
  47. title : '用户姓名'
  48. },
  49. {
  50. field : 'userPhone',
  51. title : '用户手机'
  52. },
  53. {
  54. field : 'userEmail',
  55. title : '用户邮箱'
  56. },
  57. {
  58. field : 'userBalance',
  59. title : '用户余额'
  60. },
  61. {
  62. field: 'status',
  63. title: '用户状态',
  64. align: 'center',
  65. formatter: function(value, row, index) {
  66. return $.table.selectDictLabel(datas, value);
  67. }
  68. }]
  69. };
  70. $.table.init(options);
  71. });
  72. </script>
  73. </body>
  74. </html>