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:
parent
24c0e7ca4c
commit
d1e9841e86
1 changed files with 6 additions and 3 deletions
|
@ -1199,7 +1199,7 @@ var UIDynamicList = UIElement.extend({
|
||||||
'name': this.options.name,
|
'name': this.options.name,
|
||||||
'value': value })]);
|
'value': value })]);
|
||||||
|
|
||||||
dl.querySelectorAll('.item, .add-item').forEach(function(item) {
|
dl.querySelectorAll('.item').forEach(function(item) {
|
||||||
if (exists)
|
if (exists)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1210,10 +1210,13 @@ var UIDynamicList = UIElement.extend({
|
||||||
|
|
||||||
if (hidden && hidden.value === value)
|
if (hidden && hidden.value === value)
|
||||||
exists = true;
|
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', {
|
dl.dispatchEvent(new CustomEvent('cbi-dynlist-change', {
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
detail: {
|
detail: {
|
||||||
|
|
Loading…
Reference in a new issue