From f5307dff2ac0e207f4425cb64d4e866f94aedd54 Mon Sep 17 00:00:00 2001 From: Bobby Date: Sun, 3 Apr 2022 12:47:40 +0800 Subject: [PATCH] index.html: DHCP client list re-order --- package/lean/autocore/files/x86/index.htm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/lean/autocore/files/x86/index.htm b/package/lean/autocore/files/x86/index.htm index cd63bf02c..ee3161274 100644 --- a/package/lean/autocore/files/x86/index.htm +++ b/package/lean/autocore/files/x86/index.htm @@ -188,6 +188,20 @@ }); } + var compare = function (prop) { + return function (obj1, obj2) { + var val1 = Number(obj1[prop].replaceAll(".","")); + var val2 = Number(obj2[prop].replaceAll(".","")); + if (val1 < val2) { + return -1; + } else if (val1 > val2) { + return 1; + } else { + return 0; + } + } + }; + XHR.poll(1, '<%=REQUEST_URI%>', { status: 1 }, function(x, info) { @@ -381,6 +395,7 @@ var ls = document.getElementById('lease_status_table'); if (ls) { + info.leases = info.leases.sort(compare("ipaddr")); /* clear all rows */ while( ls.rows.length > 1 ) ls.rows[0].parentNode.deleteRow(1);