Reputation: 1973
I have the following array:
options = [
"Asset Management & Investment Funds",
"Financial Institutions",
"Life Sciences",
"TMT",
"Other"
]
Choices.js by default sorts it alphabetically, and Other
ends up before TMT
which is jarring for the user.
const $projectDropdown = new Choices($this[0], {
placeholder: true,
placeholderValue: 'Select a project'
})
I tried look into the sortFilter
function, but it only specifies the method of sorting.
Upvotes: 2
Views: 4545
Reputation: 1623
Default sorting is true but you can pass another property shouldSort.
const $projectDropdown = new Choices($this[0], {
placeholder: true,
placeholderValue: 'Select a project',
shouldSort: false
})
Upvotes: 1
Reputation: 6467
It looks like you need the property shouldSort
. The readme has details.
const $projectDropdown = new Choices($this[0], {
placeholder: true,
placeholderValue: 'Select a project'
shouldSort: false,
})
Upvotes: 12