[英]How to disable the automatic sorting of items alphabetically in Choices.js?
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. 默认情况下, Choices.js按字母顺序对其进行排序,而“
Other
在TMT
之前出现,这对用户不利 。
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. 我尝试查看
sortFilter
函数,但它仅指定排序方法。
Default sorting is true but you can pass another property shouldSort. 默认排序为true,但您可以传递另一个属性shouldSort。
const $projectDropdown = new Choices($this[0], {
placeholder: true,
placeholderValue: 'Select a project',
shouldSort: false
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.