Sort elements on autocomplete