diff options
author | Simon Rettberg | 2018-04-13 14:57:08 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-04-13 14:57:08 +0200 |
commit | 7a47438b8be68835f0033ea714e1eca7e6fb2a05 (patch) | |
tree | cdd561763e6ebeaa00b92463deb26748bc92a79c /modules-available/js_stupidtable | |
parent | [js_stupidtable] Add arrow indicating sort direction to current column (diff) | |
download | slx-admin-7a47438b8be68835f0033ea714e1eca7e6fb2a05.tar.gz slx-admin-7a47438b8be68835f0033ea714e1eca7e6fb2a05.tar.xz slx-admin-7a47438b8be68835f0033ea714e1eca7e6fb2a05.zip |
[js_stupidtable] Add ipv4 sort function
Diffstat (limited to 'modules-available/js_stupidtable')
-rw-r--r-- | modules-available/js_stupidtable/clientscript.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules-available/js_stupidtable/clientscript.js b/modules-available/js_stupidtable/clientscript.js index 25027690..453e6375 100644 --- a/modules-available/js_stupidtable/clientscript.js +++ b/modules-available/js_stupidtable/clientscript.js @@ -82,6 +82,16 @@ a = a.toString().toLocaleLowerCase(); b = b.toString().toLocaleLowerCase(); return a.localeCompare(b); + }, + // OpenSLX -- IPv4 sort function + "ipv4":function(a,b){ + var aa = a.split("."); + var bb = b.split("."); + + var resulta = aa[0]*0x1000000 + aa[1]*0x10000 + aa[2]*0x100 + aa[3]*1; + var resultb = bb[0]*0x1000000 + bb[1]*0x10000 + bb[2]*0x100 + bb[3]*1; + + return resulta-resultb; } }; |