flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Mclean <jus...@classsoftware.com>
Subject Re: autosuggest component for lengthy xmls
Date Sun, 31 Mar 2013 22:45:49 GMT

> When I used it with the component, it works but it has become slow probably because of
> filtering of the xmllistcollection on each key press.

It may depends on your filter function. XML operations are generally slower than operations
on other types. You should see some speed improvement if you convert your XMLListCollection
to an ArrayCollection of Strings.

As it runs the filter function on each item in your list every time and once filtered out
an item will not show again in the list so adding a filter cache should improve speed as the
user types. Reset the cache on focus in or backspace.

Something like this, untested and may not run as it,  but it should give you an idea of what
to try.

private function filterLocation(item:Object):Boolean {
   value:String = item as String;

    if (filtered.hasOwnProperty(value)) {
	return false;    

     |f (value.indexOf(userText.toLowerCase()) >= 0) {
         return true;

     filtered[value] = true;

     return false;

View raw message