Select2开启速度很慢 [英] Select2 is slow on opening

查看:131
本文介绍了Select2开启速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Select2脚本来填充Dropdown(Asp.net C#)。如果基础选择具有相当数量的项目,则在打开其下拉菜单时,Select2会很慢。我的下拉列表中有超过15000条记录。有没有什么方法可以减缓这种速度?



我正在填写下拉代码。这是我的剧本

I'm using Select2 script to fill Dropdowns(Asp.net C#). Select2 is slow when opening its dropdown menu if the underlying select has a fair number of item. I have more than 15000 records in my dropdown. Is there any solution to reduce this slow?

I'm filling dropdown code behind. This is my script

<script type="text/javascript">
           $(".js-example-placeholder-single").select2({
               placeholder: "Select a state",
               allowClear: true
           });

       </script>

推荐答案

(。js-example-placeholder-single)。select2({
placeholder: 选择一个州,
allowClear:true
});

< / script>
(".js-example-placeholder-single").select2({ placeholder: "Select a state", allowClear: true }); </script>


15,000太多了。如果你查看源代码,你就会明白为什么你的浏览器太慢了。这对你的浏览器来说很重要。



我建议允许他们过滤。



另外,你能想象一下用户在15,000种选择中找到他们想要的单一选项会有多难吗?滚动条必须非常小,很难找到所需的内容。
15,000 is way too many. If you look at the source you'll see why it is your browser is so slow. That's a lot for your browser to handle.

I suggest allowing them to filter.

Also, can you imagine how hard it would be for a user to find the 1 single option they want out of 15,000 choices? The scroll bar must be absolutely tiny and very hard to find what they need.


这篇关于Select2开启速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆