Thursday, May 3, 2012

jQuery UI Autocomplete Combobox Very Slow With Large Select Lists


I'm using a modified version of the jQuery UI Autocomplete Combobox, as seen here: http://jqueryui.com/demos/autocomplete/#combobox



For the sake of this question, let's say I have exactly that code ^^^



When opening the combobox, either by clicking the button or focusing on the comboboxs text input, there is a large delay before showing the list of items. This delay gets noticeably larger when the select list has more options.



This delay doesn't just occur the first time either, it happens every time.



As some of the select lists on this project are very large (hundreds and hundreds of items), the delay/browser freezing up is unacceptable.



Can anyone point me in the right direction to optimise this? Or even where the performance problem may be?



I believe the issue may be to do with the way the script shows the full list of items (does an autocomplete search for an empty string), is there another way to display all items? Perhaps I could build a one off case for displaying all items (as it is common to open the list before starting to type) that doesn't do all the regex matching?



Here is a jsfiddle to fiddle with: http://jsfiddle.net/9TaMu/


Source: Tips4all

No comments:

Post a Comment