From 09ae37410e5217f157c6865a2b03482ecb55a7c2 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Wed, 8 Jun 2022 12:03:54 +0200 Subject: [PATCH] [BS5] jquery datatables disable orderable checkboxes --- data/web/js/site/admin.js | 35 +++++-- data/web/js/site/edit.js | 10 +- data/web/js/site/mailbox.js | 181 +++++++++++++++++++-------------- data/web/js/site/quarantine.js | 5 +- data/web/js/site/user.js | 25 ++++- 5 files changed, 166 insertions(+), 90 deletions(-) diff --git a/data/web/js/site/admin.js b/data/web/js/site/admin.js index f21349cde..dc7b36971 100644 --- a/data/web/js/site/admin.js +++ b/data/web/js/site/admin.js @@ -86,7 +86,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.username, @@ -145,7 +148,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -193,7 +199,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.username, @@ -245,7 +254,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.host, @@ -289,7 +301,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -341,7 +356,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -393,7 +411,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'QID', diff --git a/data/web/js/site/edit.js b/data/web/js/site/edit.js index 5c9755b38..c29aa62fe 100644 --- a/data/web/js/site/edit.js +++ b/data/web/js/site/edit.js @@ -97,7 +97,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -146,7 +149,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index acd86d9a4..3de925c37 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -240,7 +240,6 @@ jQuery(function($){ type: "GET", url: "/api/v1/get/domain/all", dataSrc: function(json){ - console.log(json); $.each(json, function(i, item) { item.aliases = item.aliases_in_domain + " / " + item.max_num_aliases_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; } }, 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 ' ' + 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 ? '' : 0==value && ''; - } - }, - { - 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 ' ' + 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 ? '' : 0==value && ''; + } + }, + { + title: lang.domain_admins, + data: 'domain_admins' + }, + { + title: lang.action, + data: 'action' + }, ] }); } @@ -421,7 +434,6 @@ jQuery(function($){ item.username = escapeHtml(item.username); }); - console.log(json); return json; } }, @@ -436,7 +448,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.username, @@ -542,7 +557,6 @@ jQuery(function($){ item.name = escapeHtml(item.name); }); - console.log(json); return json; } }, @@ -557,7 +571,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.description, @@ -617,7 +634,6 @@ jQuery(function($){ } }); - console.log(json); return json; } }, @@ -632,7 +648,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -689,7 +708,6 @@ jQuery(function($){ item.chkbox = ''; }); - console.log(json); return json; } }, @@ -704,7 +722,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -758,7 +779,6 @@ jQuery(function($){ item.chkbox = ''; }); - console.log(json); return json; } }, @@ -773,7 +793,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -857,7 +880,6 @@ jQuery(function($){ } }); - console.log(json); return json; } }, @@ -872,7 +894,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -943,7 +968,6 @@ jQuery(function($){ } }); - console.log(json); return json; } }, @@ -958,7 +982,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.alias, @@ -1039,7 +1066,6 @@ jQuery(function($){ item.exit_status = item.success + ' ' + item.exit_status; }); - console.log(json); return json; } }, @@ -1054,7 +1080,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -1130,7 +1159,6 @@ jQuery(function($){ item.chkbox = '' }); - console.log(json); return json; } }, @@ -1145,7 +1173,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', diff --git a/data/web/js/site/quarantine.js b/data/web/js/site/quarantine.js index 792c76ed3..211fd652b 100644 --- a/data/web/js/site/quarantine.js +++ b/data/web/js/site/quarantine.js @@ -75,7 +75,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', diff --git a/data/web/js/site/user.js b/data/web/js/site/user.js index a58ddd1ca..7f12f6a30 100644 --- a/data/web/js/site/user.js +++ b/data/web/js/site/user.js @@ -165,7 +165,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: lang.alias, @@ -252,7 +255,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -355,7 +361,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -419,7 +428,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID', @@ -472,7 +484,10 @@ jQuery(function($){ }, { title: '', - data: 'chkbox' + data: 'chkbox', + searchable: false, + orderable: false, + defaultContent: '' }, { title: 'ID',