shentao / vue-multiselect

Universal select/multiselect/tagging component for Vue.js

Home Page:https://vue-multiselect.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rationale behind sorting filtered options

thomaspaillot opened this issue · comments

function filterOptions (options, search, label, customLabel) {
return search ? options
.filter((option) => includes(customLabel(option, label), search))
.sort((a, b) => customLabel(a, label).length - customLabel(b, label).length) : options
}

I would like to understand the rationale behind the sort mechanism of the filtered options. As I understand it, it is sorted by the option label length, it seems to me that this is quite an opiniated choice that will not produce good result in every cases. Would you be willing to introduce a new prop to provide a custom sort function or to remove the sort?

We have noticed the "issue". Can you please provide us with the option to NOT sort by length?

It would be incredibly helpful if someone could implement prop for altering sorting mechanism. 🙏