koalyptus / TableFilter

A Javascript library making HTML tables filterable and a bit more :)
https://www.tablefilter.com
MIT License
324 stars 95 forks source link

Add combined IP/FQDN filter option #786

Open peternewman opened 3 years ago

peternewman commented 3 years ago

Enhancement/feature description I have a table with a mix of IPs and FQDNs in it, the IP sort looks good, but won't work sensibly for all FQDNs

Steps which explain the enhancement/feature E.g. sorting the following:

Current and suggested behavior Current will either pad anything with a subdomain < 3 if using IP: https://github.com/koalyptus/TableFilter/blob/b04d4f55ed47230f4571c7700c249ac5447c4ad5/src/extensions/sort/adapterSortabletable.js#L514-L537

Or sort incorrectly if not.

If it checks and if the string split has four parts and each part is a number, it should apply the IP address filter, otherwise it should leave it untouched. It should sort the results as for strings.

This could become the full behaviour of the ipAddress function if the lower casing was dropped, although it wouldn't be as efficient if the field was genuinely all just IPs.

It should probably try and handle IPv6 at some point too...

Why would the enhancement be useful to most users Allow sorting of mixed IP/FQDN records

Describe alternatives you've considered Do nothing/sort incorrectly via IP or string.