尝试修改 asmselect 以获得很长的选择列表
我的页面上有一个使用 asmselect 的多重选择,效果非常好。
我正在尝试向页面添加另一个多选,但遇到问题。大约有 11,000 个选项导致 asmselect 永远无法加载,因为它循环遍历 asmselect jquery 代码中的整个列表。即使我可以缩短加载时间,用户浏览整个列表以找到他们的选项也不会太容易。
我的想法是添加按钮,该按钮会弹出一个对话框(我成功地使用页面上其他地方的对话框来添加选择列表的选项),用户可以在其中输入一些过滤器信息,然后可以从过滤列表中进行选择。因此,他们输入 101,它会列出选项“10100”、“22101”、“31015”等。他们选择“10100”。选择后主屏幕上将显示“10100”。然后,他们可以再次点击按钮并输入“105”,这将为他们提供一个新的过滤选择列表,然后他们选择“10500”,该列表现在与“10100”一起显示在主屏幕上。
第一个问题,有没有更好的方法来处理这个问题?
其次,我可以使用 asmselect 的格式来显示新选择的项目,以便它与其他 asmselect 的格式匹配,并使用带有“删除”的内置功能来取消选择项目。我正在查看asmselect代码,但是我的jquery知识非常有限,我无法弄清楚。有人能指出我正确的方向吗?
I have a multiselect on my page using asmselect which works wonderfully.
I am trying to add another multiselect to the page, but encountering problems. There are about 11,000 options which causes the asmselect take forever to load since it's looping through the whole list in the asmselect jquery code. Even if I could improve the load time, it wouldn't be too easy for the user to look through the entire list to find their option.
My thoughts were to add button which would pop-up a dialog (I'm successfully using dialogs elsewhere on the page for adding options to select lists), where the user can enter some filter info and then can select from a filtered list. So, they type 101 and it lists options "10100", "22101", "31015" etc. They select "10100". "10100" displays on the main screen as selected. They can then hit the button again and enter "105" which will give them a new filtered select list and they select "10500" which now shows along with "10100" on the main screen.
First question, is there a better way to handle this?
Second, can I use the formatting for asmselect to display my newly selected items so that it matches with the formatting of my other asmselect and use the built-in functionality with the "remove" for unselecting an item. I'm looking at the asmselect code, but my jquery knowledge is very limited and I can't figure it out. Could someone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过使用 droplistFilter 插件 在对话框中提供选项下拉列表来实现此目的。当从下拉列表中选择一个选项并单击对话框的“添加”按钮时,该选项被添加到我的多重选择中(使用 asmselect 插件)并设置为选定状态,并且我从下拉列表中禁用了该选项。在我的 $(document).ready(function() { 中,我将多选中的每个选定选项设置为在下拉列表中禁用。
I achieved this by having a dropdown list of the options in a dialog using a droplistFilter plugin. When an option was selected from the dropdown and the "add" button of the dialog was clicked, the option was added to my multiselect (using the asmselect plugin) and set to selected and I disabled the option from the dropdown list. In my
$(document).ready(function() {
I set each selected option in my multiselect to disabled in the dropdown.