diff --git a/groups-clients.php b/groups-clients.php
index 6888ccc9..da8681f6 100644
--- a/groups-clients.php
+++ b/groups-clients.php
@@ -74,6 +74,7 @@
+
diff --git a/scripts/pi-hole/js/groups-clients.js b/scripts/pi-hole/js/groups-clients.js
index 49da0613..d9a8ee4e 100644
--- a/scripts/pi-hole/js/groups-clients.js
+++ b/scripts/pi-hole/js/groups-clients.js
@@ -82,7 +82,7 @@ function initTable() {
order: [[0, "asc"]],
columns: [
{ data: "id", visible: false },
- { data: "ip" },
+ { data: "ip", type: "ip-address" },
{ data: "comment" },
{ data: "groups", searchable: false },
{ data: "name", width: "80px", orderable: false }
diff --git a/scripts/pi-hole/js/ip-address-sorting.js b/scripts/pi-hole/js/ip-address-sorting.js
index d636ecf9..8bbaa152 100644
--- a/scripts/pi-hole/js/ip-address-sorting.js
+++ b/scripts/pi-hole/js/ip-address-sorting.js
@@ -23,9 +23,16 @@ jQuery.extend(jQuery.fn.dataTableExt.oSort, {
var m = a.split("."),
n = a.split(":"),
x = "",
- xa = "";
+ xa = "",
+ cidr = [];
if (m.length === 4) {
- // IPV4
+ // IPV4 (possibly with CIDR)
+ cidr = m[3].split("/");
+ if (cidr.length === 2) {
+ m.pop();
+ m = m.concat(cidr);
+ }
+
for (i = 0; i < m.length; i++) {
item = m[i];
@@ -38,7 +45,7 @@ jQuery.extend(jQuery.fn.dataTableExt.oSort, {
}
}
} else if (n.length > 0) {
- // IPV6
+ // IPV6 (possibly with CIDR)
var count = 0;
for (i = 0; i < n.length; i++) {
item = n[i];
@@ -79,6 +86,21 @@ jQuery.extend(jQuery.fn.dataTableExt.oSort, {
x += item;
}
}
+
+ cidr = x.split("/");
+ x = cidr[0];
+ if (cidr.length === 2) {
+ item = cidr[1];
+ if (item.length === 1) {
+ x += "00" + item;
+ } else if (item.length === 2) {
+ x += "0" + item;
+ } else {
+ x += item;
+ }
+ }
+
+ console.log([a, n, xa, count, x]);
}
return x;