From: Paul Donald Date: Mon, 25 Nov 2024 20:32:39 +0000 (+0100) Subject: luci-base: form: fix sort order bug triggered by integer types X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=fefb9acf57ad11012c336e4d056b074620b87d2f;p=openwrt-luci.git luci-base: form: fix sort order bug triggered by integer types Signed-off-by: Paul Donald --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 53ea3c5bcd..7cf2ae7597 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -3068,8 +3068,10 @@ var CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection.p n.classList.remove('flash') }); + val = Array.isArray(val) ? val.join(' '): val; + val = `${val}`; // coerce non-string types to string list.push([ - ui.Table.prototype.deriveSortKey((val != null) ? val.trim() : ''), + ui.Table.prototype.deriveSortKey((val != null && typeof val.trim === 'function') ? val.trim() : ''), tr ]); }, this));