Give us a call 203-379-0773
Check out our Angular Book Series.

The Difference Between AutoComplete and Look-Ahead

Recently, Flextras rebuilt our AutoCompleteComboBox Flex Component using the Flex 4 Spark Architecture. Since it has a limited API at the moment, we've released it free for production use and you can download it as part of our developer edition. A few people have asked what the difference is between our component and the Flex 4 ComboBox.

The Flex Spark ComboBox provides look ahead functionality. That means when you type it scrolls to the item and the input box also shows the "rest" of the first item selected. For example if you had a list of US states and type 'Ca' the drop down would scroll to California Your typed text would be 'Ca' and "lifornia" would be filled in and highlighted as part of your input. Here is a screenshot:

An AutoComplete actually filters your dataProvider; meaning it limits the number of items you can choose based on the words you type. The filter function is exposed as an API, so you can filter the drop down using any function you want; it doesn't have to be a first letter only, which is what you get with the scrolling of the Flex Spark ComboBox.

Our AutoComplete Component also highlights the typed text in the drop down with the text you typed.

Using our AutoCompleteComboBox, with the same list of states, if you typed 'Ca' the first element in the AutoComplete would be California (With a Bolded Ca). States without 'Ca' would be removed, such as Alabama, Delaware, Florida, and others. But, states with Cs, such as North Carolina or South Carolina would still be listed. Here is a screenshot:

Our AutoComplete also has an API that lets you control the filtering, and control the renderer highlighting. More info about both are in our AutoComplete Manual.

Here is a sample of the two components side by side:

And, of course the source code.

What else can I do for you today?

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Haemp's Gravatar Good clarification Jeff. Is there any scenario where it would be better to use the Flex Combobox instead of yours?
# Posted By Haemp | 3/11/11 2:49 PM
Jeffry Houser's Gravatar @haemp It really depends on the application you're building and what you want to do.

If you have a small set of items, then a ComboBox may be the better choice. I'd put that number at 6, which is the default number of items displayed in the ComboBox w/o having to scroll the list.

If you have a really large list of items, then an AutoComplete is better. Being able to slim things down and show the user less data is important.

If you wanted to ping the database and change the dataProvider with each keystroke, then an AutoComplete is a much better choice. That specific use case is not something we've tested in our Spark version yet--it is something that works wonderfully in our MX version.

We're working on building out the API of our Spark AutoComplete Component. The MX version has a lot of different ways to select the first item in the list; such as 'onEnter' or 'onEqual' or 'onOne'. None of those exist in the Flex version. People keep asking us for these APIs, and we keep implementing them.
# Posted By Jeffry Houser | 3/11/11 3:16 PM