Javascript 如何在Choices.js中禁用按字母顺序自动排序项目?

Javascript 如何在Choices.js中禁用按字母顺序自动排序项目?,javascript,html-select,Javascript,Html Select,我有以下数组: options = [ "Asset Management & Investment Funds", "Financial Institutions", "Life Sciences", "TMT", "Other" ] 默认情况下,按字母顺序对其排序,而其他排序则排在TMT之前,这对用户来说是不和谐的 const $projectDropdown = new Choices($this[0], { placeholder: true, pl

我有以下数组:

options = [
  "Asset Management & Investment Funds",
  "Financial Institutions",
  "Life Sciences",
  "TMT",
  "Other"
]
默认情况下,按字母顺序对其排序,而其他排序则排在TMT之前,这对用户来说是不和谐的

const $projectDropdown = new Choices($this[0], {
  placeholder: true,
  placeholderValue: 'Select a project'
})

我尝试查看sortFilter函数,但它只指定排序方法。

看起来您需要shouldSort属性。报告有细节

const $projectDropdown = new Choices($this[0], {
  placeholder: true,
  placeholderValue: 'Select a project'
  shouldSort: false,
})

看起来您需要属性shouldSort。报告有细节

const $projectDropdown = new Choices($this[0], {
  placeholder: true,
  placeholderValue: 'Select a project'
  shouldSort: false,
})

默认排序为true,但您可以传递另一个属性shouldSort

const $projectDropdown = new Choices($this[0], {
  placeholder: true,
  placeholderValue: 'Select a project',
  shouldSort: false
})

默认排序为true,但您可以传递另一个属性shouldSort

const $projectDropdown = new Choices($this[0], {
  placeholder: true,
  placeholderValue: 'Select a project',
  shouldSort: false
})