Sorteeri elemendid ja asenda wrapperi sisu.
shops = document.querySelectorAll('.ui-sortable-handle')
shopsList = Array.prototype.slice.call(shops, 0);
newList = shopsList.sort((a, b) => {
let aText = a.childNodes[0].textContent;
let bText = b.childNodes[0].textContent;
if (aText > bText) return 1;
if (aText < bText) return -1;
return 0;
})
wrapper = document.querySelector('#sortable')
wrapper.innerHTML=''
newList.forEach(function(item){
wrapper.appendChild(item.cloneNode(true));
});
document.querySelector('#save-order').click()
0