浏览代码

[BS5] jquery datatables disable orderable checkboxes

FreddleSpl0it 3 年之前
父节点
当前提交
09ae37410e
共有 5 个文件被更改,包括 166 次插入90 次删除
  1. 28 7
      data/web/js/site/admin.js
  2. 8 2
      data/web/js/site/edit.js
  3. 106 75
      data/web/js/site/mailbox.js
  4. 4 1
      data/web/js/site/quarantine.js
  5. 20 5
      data/web/js/site/user.js

+ 28 - 7
data/web/js/site/admin.js

@@ -86,7 +86,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: lang.username,
             title: lang.username,
@@ -145,7 +148,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -193,7 +199,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: lang.username,
             title: lang.username,
@@ -245,7 +254,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: lang.host,
             title: lang.host,
@@ -289,7 +301,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -341,7 +356,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -393,7 +411,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'QID',
             title: 'QID',

+ 8 - 2
data/web/js/site/edit.js

@@ -97,7 +97,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -146,7 +149,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',

+ 106 - 75
data/web/js/site/mailbox.js

@@ -240,7 +240,6 @@ jQuery(function($){
         type: "GET",
         type: "GET",
         url: "/api/v1/get/domain/all",
         url: "/api/v1/get/domain/all",
         dataSrc: function(json){
         dataSrc: function(json){
-          console.log(json);
           $.each(json, function(i, item) {
           $.each(json, function(i, item) {
             item.aliases = item.aliases_in_domain + " / " + item.max_num_aliases_for_domain;
             item.aliases = item.aliases_in_domain + " / " + item.max_num_aliases_for_domain;
             item.mailboxes = item.mboxes_in_domain + " / " + item.max_num_mboxes_for_domain;
             item.mailboxes = item.mboxes_in_domain + " / " + item.max_num_mboxes_for_domain;
@@ -279,66 +278,80 @@ jQuery(function($){
             }
             }
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
       columns: [
       columns: [
-          {
-            title: lang.domain,
-            data: 'domain_name'
-          },
-          {
-            title: lang.aliases,
-            data: 'aliases_in_domain'
-          },
-          {
-            title: lang.mailboxes,
-            data: 'mboxes_in_domain'
-          },
-          {
-            title: lang.domain_quota,
-            data: 'quota',
-            render: function (data, type) {
-              data = data.split("/");
-              return humanFileSize(data[0]) + " / " + humanFileSize(data[1]);
-            }
-          },
-          {
-            title: lang.stats,
-            data: 'stats',
-            render: function (data, type) {
-              data = data.split("/");
-              return '<i class="bi bi-files"></i> ' + data[0] + ' / ' + humanFileSize(data[1]);
-            }
-          },
-          {
-            title: lang.mailbox_defquota,
-            data: 'def_quota_for_mbox'
-          },
-          {
-            title: lang.mailbox_quota,
-            data: 'max_quota_for_mbox'
-          },
-          {
-            title: 'RL',
-            data: 'rl'
-          },
-          {
-            title: lang.backup_mx,
-            data: 'backupmx',
-            redner: function (data, type){
-              return 1==value ? '<i class="bi bi-check-lg"></i>' : 0==value && '<i class="bi bi-x-lg"></i>';
-            }
-          },
-          {
-            title: lang.domain_admins,
-            data: 'domain_admins'
-          },
-          {
-            title: lang.action,
-            data: 'action'
-          },
+        {
+          // placeholder, so checkbox will not block child row toggle
+          title: '',
+          data: null,
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
+        },
+        {
+          title: '',
+          data: 'chkbox',
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
+        },
+        {
+          title: lang.domain,
+          data: 'domain_name'
+        },
+        {
+          title: lang.aliases,
+          data: 'aliases_in_domain'
+        },
+        {
+          title: lang.mailboxes,
+          data: 'mboxes_in_domain'
+        },
+        {
+          title: lang.domain_quota,
+          data: 'quota',
+          render: function (data, type) {
+            data = data.split("/");
+            return humanFileSize(data[0]) + " / " + humanFileSize(data[1]);
+          }
+        },
+        {
+          title: lang.stats,
+          data: 'stats',
+          render: function (data, type) {
+            data = data.split("/");
+            return '<i class="bi bi-files"></i> ' + data[0] + ' / ' + humanFileSize(data[1]);
+          }
+        },
+        {
+          title: lang.mailbox_defquota,
+          data: 'def_quota_for_mbox'
+        },
+        {
+          title: lang.mailbox_quota,
+          data: 'max_quota_for_mbox'
+        },
+        {
+          title: 'RL',
+          data: 'rl'
+        },
+        {
+          title: lang.backup_mx,
+          data: 'backupmx',
+          redner: function (data, type){
+            return 1==value ? '<i class="bi bi-check-lg"></i>' : 0==value && '<i class="bi bi-x-lg"></i>';
+          }
+        },
+        {
+          title: lang.domain_admins,
+          data: 'domain_admins'
+        },
+        {
+          title: lang.action,
+          data: 'action'
+        },
       ]
       ]
     });
     });
   }
   }
@@ -421,7 +434,6 @@ jQuery(function($){
             item.username = escapeHtml(item.username);
             item.username = escapeHtml(item.username);
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -436,7 +448,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: lang.username,
             title: lang.username,
@@ -542,7 +557,6 @@ jQuery(function($){
             item.name = escapeHtml(item.name);
             item.name = escapeHtml(item.name);
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -557,7 +571,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: lang.description,
             title: lang.description,
@@ -617,7 +634,6 @@ jQuery(function($){
             }
             }
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -632,7 +648,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -689,7 +708,6 @@ jQuery(function($){
             item.chkbox = '<input type="checkbox" data-id="recipient_map" name="multi_select" value="' + item.id + '" />';
             item.chkbox = '<input type="checkbox" data-id="recipient_map" name="multi_select" value="' + item.id + '" />';
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -704,7 +722,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -758,7 +779,6 @@ jQuery(function($){
             item.chkbox = '<input type="checkbox" data-id="tls-policy-map" name="multi_select" value="' + item.id + '" />';
             item.chkbox = '<input type="checkbox" data-id="tls-policy-map" name="multi_select" value="' + item.id + '" />';
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -773,7 +793,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -857,7 +880,6 @@ jQuery(function($){
             }
             }
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -872,7 +894,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -943,7 +968,6 @@ jQuery(function($){
             }
             }
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -958,7 +982,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: lang.alias,
             title: lang.alias,
@@ -1039,7 +1066,6 @@ jQuery(function($){
             item.exit_status = item.success + ' ' + item.exit_status;
             item.exit_status = item.success + ' ' + item.exit_status;
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -1054,7 +1080,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',
@@ -1130,7 +1159,6 @@ jQuery(function($){
             item.chkbox = '<input type="checkbox" data-id="filter_item" name="multi_select" value="' + item.id + '" />'
             item.chkbox = '<input type="checkbox" data-id="filter_item" name="multi_select" value="' + item.id + '" />'
           });
           });
 
 
-          console.log(json);
           return json;
           return json;
         }
         }
       },
       },
@@ -1145,7 +1173,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',

+ 4 - 1
data/web/js/site/quarantine.js

@@ -75,7 +75,10 @@ jQuery(function($){
           },
           },
           {
           {
             title: '',
             title: '',
-            data: 'chkbox'
+            data: 'chkbox',
+            searchable: false,
+            orderable: false,
+            defaultContent: ''
           },
           },
           {
           {
             title: 'ID',
             title: 'ID',

+ 20 - 5
data/web/js/site/user.js

@@ -165,7 +165,10 @@ jQuery(function($){
         },
         },
         {
         {
           title: '',
           title: '',
-          data: 'chkbox'
+          data: 'chkbox',
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
         },
         },
         {
         {
           title: lang.alias,
           title: lang.alias,
@@ -252,7 +255,10 @@ jQuery(function($){
         },
         },
         {
         {
           title: '',
           title: '',
-          data: 'chkbox'
+          data: 'chkbox',
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
         },
         },
         {
         {
           title: 'ID',
           title: 'ID',
@@ -355,7 +361,10 @@ jQuery(function($){
         },
         },
         {
         {
           title: '',
           title: '',
-          data: 'chkbox'
+          data: 'chkbox',
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
         },
         },
         {
         {
           title: 'ID',
           title: 'ID',
@@ -419,7 +428,10 @@ jQuery(function($){
         },
         },
         {
         {
           title: '',
           title: '',
-          data: 'chkbox'
+          data: 'chkbox',
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
         },
         },
         {
         {
           title: 'ID',
           title: 'ID',
@@ -472,7 +484,10 @@ jQuery(function($){
         },
         },
         {
         {
           title: '',
           title: '',
-          data: 'chkbox'
+          data: 'chkbox',
+          searchable: false,
+          orderable: false,
+          defaultContent: ''
         },
         },
         {
         {
           title: 'ID',
           title: 'ID',