dijit.form.select dropdown is very slow
Loading 3000 values into dijit.form.select control takes longer time. browser gets hanged even for 500 开发者_高级运维values. How to over come this problem?
Any assistance would be really appreciated.
Thanks, Karthihck k.
Loading 3,000 of anything into a web page is always going to be slow.
Although there are twisted ways to overcome this limitation, it may not be worth it for your user is definitely not going to like scrolling through 3,000 items to pick one!
I'd suggest you break this drop-down list into two (or three) levels, and have no more than 20-30 choices each. In one of my own projects with thousands of list items, I had to go with four levels, otherwise performance gets abysmal.
If you only have one long list to work with, consider breaking it down by the starting letter into 26 groups, like a phone list. At least you'll have only 100-200 in each group.
Now, if you really really want to load such a long list, consider not using dijit.form.Select
as it is just a simple wrapper for the <select>
tag. You're essentially inserting one <option>
tag at a time, killing performance. You have two choices:
- Create the list of
<option>
tags yourself off-line, then insert into the<select>
element in one go. - Consider
dijit.form.FilteringSelect
instead.
Now, I definitely don't endorse doing the above. You've been warned!
精彩评论