【发布时间】:2014-01-24 01:45:04
【问题描述】:
我目前正在使用Chosen jQuery plugin。 在这里查看我的小提琴:http://jsfiddle.net/3XWSe/
在 Chrome 和 Internet Explorer 中尝试小提琴(我使用 IE 版本 11 进行了测试)。
请注意,在 Internet Explorer 中单击多选时会有延迟(4 或 5 秒),而在 Chrome 中单击多选则很少,几乎没有。这个示例下拉列表列出了德克萨斯州的所有城市,并且有近 5000 个选项。
我打开 chosen.jquery.js 并将问题追溯到这个调用:
Chosen.prototype.update_results_content = function(content) {
return this.search_results.html(content); //<-- Problem here when loading the large amount of HTML into the element
};
我注意到,在第一次点击之后,如果我停止 this.search_results.html 更新所有后续点击,多选将不再响应缓慢。为了解决第一次点击的问题,我可能需要以某种方式预加载内容。有什么想法吗?
关于如何解决 IE 的这个性能问题的任何建议,或者你知道另一个 类似的 jQuery 插件 可以处理 IE 中的这些大量选项吗? (我试过 select2 和其他一些都无济于事)。
编辑:由于这个问题已经流行了一年,我想让大家知道我放弃了选择,现在使用 Select2 4.0(它有很好的performance with large data and infinite scroll)。它似乎旨在让开发人员更轻松地对其进行装饰和修改,并且可以在移动设备上运行。
【问题讨论】:
-
我知道我的回答不是你想听到的......但不幸的是它是事实。
标签: jquery performance multi-select jquery-chosen large-data