Sorting the relationship query in the admin with a filter is fairly trivial (e.g. https://www.advancedcustomfields.com/resources/acf-fields-relationship-query/), but is there an equivalent for the values chosen? For example, I want the _selected_ items to remain alphabetical and not based on the clicked order. Is this possible? Maybe with the javascript API?
Sadly not possible from ACF itself.
But with some creative jQuery it is certainly possible;
$('.acf-relationship .selection .values ul.acf-bl.list.values-list').each(function () {
var mylist = $(this);
var listitems = mylist.children('li').get();
listitems.sort(function (a, b) {
return $(a).text().toUpperCase().localeCompare($(b).text().toUpperCase());
})
$.each(listitems, function (idx, itm) {
var txt = $(this).text();
mylist.append(itm);
});
});
Enjoy!