Merge pull request #1948 from pi-hole/tweak/datatables

Tweak to datatables column rendering
This commit is contained in:
yubiuser
2021-10-28 20:21:01 +02:00
committed by GitHub
11 changed files with 78 additions and 10 deletions
+5
View File
@@ -64,6 +64,10 @@ $(function () {
);
},
},
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
lengthMenu: [
[10, 25, 50, 100, -1],
@@ -82,6 +86,7 @@ $(function () {
$(".deleteCustomCNAME").on("click", deleteCustomCNAME);
},
});
// Disable autocorrect in the search box
var input = document.querySelector("input[type=search]");
input.setAttribute("autocomplete", "off");
+4
View File
@@ -64,6 +64,10 @@ $(function () {
);
},
},
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
lengthMenu: [
[10, 25, 50, 100, -1],
+6 -2
View File
@@ -340,8 +340,8 @@ $(function () {
},
},
{ width: "10%" },
{ width: "40%", render: $.fn.dataTable.render.text() },
{ width: "20%", type: "ip-address", render: $.fn.dataTable.render.text() },
{ width: "40%" },
{ width: "20%", type: "ip-address" },
{ width: "10%" },
{ width: "5%" },
],
@@ -355,6 +355,10 @@ $(function () {
data: null,
defaultContent: "",
},
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
initComplete: reloadCallback,
});
+10
View File
@@ -124,6 +124,16 @@ function initTable() {
{ data: "groups", searchable: false },
{ data: null, width: "80px", orderable: false },
],
columnDefs: [
{
targets: [0, 2],
orderable: false,
},
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
drawCallback: function () {
$('button[id^="deleteAdlist_"]').on("click", deleteAdlist);
// Remove visible dropdown to prevent orphaning
+6
View File
@@ -97,6 +97,12 @@ function initTable() {
{ data: "groups", searchable: false },
{ data: "name", width: "80px", orderable: false },
],
columnDefs: [
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
drawCallback: function () {
$('button[id^="deleteClient_"]').on("click", deleteClient);
// Remove visible dropdown to prevent orphaning
+6
View File
@@ -76,6 +76,12 @@ function initTable() {
{ data: "groups", searchable: false, visible: showtype === "all" },
{ data: null, width: "80px", orderable: false },
],
columnDefs: [
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
drawCallback: function () {
$('button[id^="deleteDomain_"]').on("click", deleteDomain);
// Remove visible dropdown to prevent orphaning
+6
View File
@@ -27,6 +27,12 @@ $(function () {
{ data: "description" },
{ data: null, width: "60px", orderable: false },
],
columnDefs: [
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
drawCallback: function () {
$('button[id^="deleteGroup_"]').on("click", deleteGroup);
},
+6
View File
@@ -114,6 +114,12 @@ $(function () {
{ data: "blob5", visible: false },
{ data: null, width: "80px", orderable: false },
],
columnDefs: [
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
drawCallback: function () {
$('button[id^="deleteMessage_"]').on("click", deleteMessage);
// Remove visible dropdown to prevent orphaning
+9 -4
View File
@@ -236,10 +236,10 @@ $(function () {
order: [[6, "desc"]],
columns: [
{ data: "id", visible: false },
{ data: "ip", type: "ip-address", width: "10%", render: $.fn.dataTable.render.text() },
{ data: "hwaddr", width: "10%", render: $.fn.dataTable.render.text() },
{ data: "interface", width: "4%", render: $.fn.dataTable.render.text() },
{ data: "name", width: "15%", render: $.fn.dataTable.render.text() },
{ data: "ip", type: "ip-address", width: "10%" },
{ data: "hwaddr", width: "10%" },
{ data: "interface", width: "4%" },
{ data: "name", width: "15%" },
{
data: "firstSeen",
width: "8%",
@@ -266,6 +266,7 @@ $(function () {
{ data: "", width: "6%", orderable: false },
{ data: "", width: "6%", orderable: false },
],
drawCallback: function () {
$('button[id^="deleteNetworkEntry_"]').on("click", deleteNetworkEntry);
// Remove visible dropdown to prevent orphaning
@@ -289,6 +290,10 @@ $(function () {
data: null,
defaultContent: "",
},
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
});
// Disable autocorrect in the search box
+6 -2
View File
@@ -323,8 +323,8 @@ $(function () {
},
},
{ width: "4%" },
{ width: "36%", render: $.fn.dataTable.render.text() },
{ width: "8%", type: "ip-address", render: $.fn.dataTable.render.text() },
{ width: "36%" },
{ width: "8%", type: "ip-address" },
{ width: "14%", orderData: 4 },
{ width: "8%", orderData: 5 },
{ width: "10%", orderData: 4 },
@@ -347,6 +347,10 @@ $(function () {
data: null,
defaultContent: "",
},
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
initComplete: function () {
var api = this.api();
+14 -2
View File
@@ -216,7 +216,13 @@ $(function () {
if (document.getElementById("DHCPLeasesTable")) {
leasetable = $("#DHCPLeasesTable").DataTable({
dom: "<'row'<'col-sm-12'tr>><'row'<'col-sm-6'i><'col-sm-6'f>>",
columnDefs: [{ bSortable: false, orderable: false, targets: -1 }],
columnDefs: [
{ bSortable: false, orderable: false, targets: -1 },
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
paging: false,
scrollCollapse: true,
scrollY: "200px",
@@ -236,7 +242,13 @@ $(function () {
if (document.getElementById("DHCPStaticLeasesTable")) {
staticleasetable = $("#DHCPStaticLeasesTable").DataTable({
dom: "<'row'<'col-sm-12'tr>><'row'<'col-sm-12'i>>",
columnDefs: [{ bSortable: false, orderable: false, targets: -1 }],
columnDefs: [
{ bSortable: false, orderable: false, targets: -1 },
{
targets: "_all",
render: $.fn.dataTable.render.text(),
},
],
paging: false,
scrollCollapse: true,
scrollY: "200px",