IP address column in Network Overview doesn't sort

IP address (hostname) [no action]
Hardware address [sorts fine]
Interface [sorts fine]
First seen [sorts fine]
Last Query [sorts fine]
Number of queries [sorts fine]

How do you sort by a column that has multiple values in it?
Pi-hole v5.x does it based on the first address (note that "first" is completely random here!).

Either wo do it like this or disallow sorting by this column. The ambiguity of what is the first address suggests we actually drop this altogether but I see that this may not be what users are expecting.

What do we do about it?

I'd skip sorting the IP address column altogether.

There's too many variables to it, e.g. IPv6 may be preferred over IPv4, or ULA over GUA,or newer IPs over older ones,...

I'd think about sorting in the same manner that the table is populated. It appears that the code determines if a host name is available and, if so, prints the ip addresses then the host name. If there is no hostname, just the ip addresses are printed. Thus, an IP address is always present.

So, I'd say just sort on the IP4 address (or concat the IP4 and IP6 addresses). If the IP4 address is null, it would go to the top of the list, but that seems OK because the host names are in parens. I don't see a need to then sort on hostnames.

var ips = []; maxiter = Math.min(data.ips.length, MAXIPDISPLAY); for (index = 0; index < maxiter; index++) { var ip = data.ips[index]; if (ip.name !== null && ip.name.length > 0) ips.push( '<a href="queries.lp?client_ip=' + ip.ip + '">' + ip.ip + " (" + ip.name + ")</a>" ); else ips.push('<a href="queries.lp?client_ip=' + ip.ip + '">' + ip.ip + "</a>"); }