Open shoniax opened 3 years ago
I have the same problem, the user defined order is not preserved into the form submittal - it will always be the same order as the original left sided options.
Same problem here ... left side options order rules on the right side.
Same problem here
+1
I encounter the same problem but only on Chrome. It works fine with Firefox.
I have run a few tests and it seems to come down to the browser sorting algorithm, maybe related to this explanation ?
I checked it run in here https://preview.keenthemes.com/metronic/demo9/features/miscellaneous/dual-listbox.html anyone have solution ?
_initializeSortButtons() { let t = document.createElement("button"); t.classList.add("dual-listbox__button"), t.innerText = this.upButtonText, t.addEventListener("click", i => this._onSortButtonClick(i, h, 'selected')); let e = document.createElement("button"); e.classList.add("dual-listbox__button"), e.innerText = this.downButtonText, e.addEventListener("click", i => this._onSortButtonClick(i, u, 'selected')); let s = document.createElement("div"); s.classList.add("dual-listbox_sortButtons"), s.appendChild(t), s.appendChild(e), this.selectedListTitle.appendChild(s)
t = document.createElement("button");
t.classList.add("dual-listbox__button"), t.innerText = this.upButtonText, t.addEventListener("click", i => this._onSortButtonClick(i, h, 'available'));
e = document.createElement("button");
e.classList.add("dual-listbox__button"), e.innerText = this.downButtonText, e.addEventListener("click", i => this._onSortButtonClick(i, u, 'available'));
s = document.createElement("div");
s.classList.add("dual-listbox_sortButtons"), s.appendChild(t), s.appendChild(e), this.availableListTitle.appendChild(s)
}
_onSortButtonClick(t, e, as) { t.preventDefault(); let list = this.dualListbox.querySelector(".dual-listbox__"+as); let orderedLIs = [...list.children].sort((a, b) => a.textContent.localeCompare(b.textContent) ); if (e=="down") orderedLIs = orderedLIs.reverse(); list.innerHTML = orderedLIs.map(li => li.outerHTML).join(''); }
Hello , when I change order of selected items I got random sort when i try to print it.
Here is the result