diff options
author | Jo-Philipp Wich <jo@mein.io> | 2019-08-14 22:44:54 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2019-08-14 22:46:19 +0200 |
commit | d1e9841e86a30df7c8625e9e6c967a5b90c601f1 (patch) | |
tree | cc5f461c2ad18eedf37a8d332eec49ba7f405b4a /modules/luci-base/htdocs/luci-static | |
parent | 24c0e7ca4c9d9fbffc94133e710facdb039fedab (diff) |
luci-base: ui.js: do not forcibly sort synamic list items
Ref: https://forum.openwrt.org/t/cannot-save-certain-fields/42738/2
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/htdocs/luci-static')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 29233dec02..11886b91fe 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1199,7 +1199,7 @@ var UIDynamicList = UIElement.extend({ 'name': this.options.name, 'value': value })]); - dl.querySelectorAll('.item, .add-item').forEach(function(item) { + dl.querySelectorAll('.item').forEach(function(item) { if (exists) return; @@ -1210,10 +1210,13 @@ var UIDynamicList = UIElement.extend({ if (hidden && hidden.value === value) exists = true; - else if (!hidden || hidden.value >= value) - exists = !!item.parentNode.insertBefore(new_item, item); }); + if (!exists) { + var ai = dl.querySelector('.add-item'); + ai.parentNode.insertBefore(new_item, ai); + } + dl.dispatchEvent(new CustomEvent('cbi-dynlist-change', { bubbles: true, detail: { |