Tom-Select使用拖放插件时如何保持订单
我将tom-select用于多个选择字段, Drop插件
提供给选择的选项是按字母顺序排序的,当我选择某些项目时,一切正常,它们按照预期的是手动分类的顺序将它们保存在db中。问题是,当我重新加载页面时,这些选定的项目还是按字母顺序显示的。有什么方法可以对它们进行自定义方式?
I'm using tom-select for multiple select field with drag & drop plugin
Options provided to the select are alphabetically sorted, everything works fine when I choose some items, they are saved in db in the order I'v sorted them manually, as expected. Problem is that when I reload the page those selected items are shown in alphabetical order anyway. Is there any way to sort them custom way ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Tom Select将按照您的代码指示订购项目(选定选项)。
vs
如果您不告诉汤姆选择要订购的物品的方式,它将使用SELECT中的选项顺序。
Tom Select will order items (selected options) as instructed by your code.
vs
If you don't tell Tom Select how you want items ordered, it will use the order of the options in the select.
如果我想通过选择顺序订购,而不是选项顺序,刺激控制器的一部分:
I'v resolved it by passing selected ids if I want to have it ordered by selection order, not options order, part of stimulus controller: