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>
This commit is contained in:
Jo-Philipp Wich 2019-08-14 22:44:54 +02:00
parent 24c0e7ca4c
commit d1e9841e86

View file

@ -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: {