开发者

Best way to support large dropdowns

开发者 https://www.devze.com 2022-12-22 18:32 出处:网络
Say I have a report that can be restricted by specifying some value in a dropdown. This dropdown list references a table with > 30,000 records. I don\'t think this would be feasible to populate a drop

Say I have a report that can be restricted by specifying some value in a dropdown. This dropdown list references a table with > 30,000 records. I don't think this would be feasible to populate a dropdown 开发者_运维问答with! So, what is the best way to provide the user the ability to select a value given this situation? These values do not really have categories and even if I subdivided (by having some nesting dropdown situation) by the first letter of the value, that may still leave a few thousand entries.

What's the best way to deal with this?


Search, don't categorise.

You can display the control as a simple text box, and when the user types in a few characters, you could pop up an autocomplete-like dropdown to select the final value. Here's a link to the jQuery plugin for autocomplete.


I really wouldn't have a 30,000 element drop-down. The GUI is supposed to make it easier on the user rather than harder.

If you have no other way to categorise the data other than alphabetically, you're not restricted to using a two-stage approach with just the first character. Make it reliant on the first two characters.

This would give you at most 676 (assuming alphas only) in the first drop-down and (on average) 44 in the second.

We've actually taken two approaches to this problem. BIRT (which we use) allows for cascading parameters which can easily run that second-level query whenever you change the first drop-down box.

However, some of our customers care absolutely zero for nice GUI stuff (other than the output of nice 9-point Verdana and beautiful charts to placate management, of course). They prefer a free-form text entry field where they can just type in "SYS_PAX_%" to change their queries.

Of course, these are the customers that know exactly what data is in their database and use values which lend themselves to categorisation with SQL LIKE clauses. Others prefer the ability to search.


I had this same question about 2 years ago concerning a asp.net dropdown box.

Trust me, don't even try it. Use the auto complete suggestions above. I've found that displaying anything above 5000 records tends to crash the browser.

Just my 2 cents.


+1 @pax. Still i'd like to see a 30K dropdown! :)

@JustAProgrammer, perhaps you could do a text box where people can type in the beginning of what they are looking for and you can filter as they type in.


If you're asking from a performance perspective rather than a usability perspective I would consider using a live-list approach that loads only a subset of the list items on demand as you scroll up or down. If the user clicks down the list quickly, to say the middle, it will load another 10 elements corresponding to that position. Both render time and load time will be much faster.

Like paging, but 'fluid'.


Auto complete drop down as suggested above is best to have. But it will require the users to have some idea about the type of entries to start with. If the users are familiar with data, go for it.

Alternatively, if you can categorize your data, then you can start with the categories first and then based on the selection you can populate the dependent drop down with actual values which will be a subset of original values.

0

精彩评论

暂无评论...
验证码 换一张
取 消