luci-base: cbi.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>
(backported from commit dbf83e35bb6e4d203eca917d4dfef2b270dd34ff)
This commit is contained in:
Jo-Philipp Wich 2019-08-14 22:34:02 +02:00
parent 0fc125a866
commit 5d2a0f17e1

View file

@ -903,7 +903,7 @@ CBIDynamicList = {
'name': dl.getAttribute('data-prefix'),
'value': value })]);
dl.querySelectorAll('.item, .add-item').forEach(function(item) {
dl.querySelectorAll('.item').forEach(function(item) {
if (exists)
return;
@ -911,10 +911,13 @@ CBIDynamicList = {
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);
}
cbi_d_update();
},