我有以下数组:
options = [
"Asset Management & Investment Funds",
"Financial Institutions",
"Life Sciences",
"TMT",
"Other"
]
Choices.js默认情况下按字母顺序排序,Other
排在 TMT
之前,这对用户来说是不舒服的。
const $projectDropdown = new Choices($this[0], {
placeholder: true,
placeholderValue: 'Select a project'
})
我尝试查看sortFilter
函数,但它只指定了排序方法。
最佳答案
看起来您需要属性shouldSort
。 readme有详细信息。
const $projectDropdown = new Choices($this[0], {
placeholder: true,
placeholderValue: 'Select a project'
shouldSort: false,
})
关于javascript - 如何在 Choices.js 中禁用按字母顺序自动排序项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51667224/