Recently I was using Adobe’s AutoComplete component and a problem cropped up, it applies a filter to the original dataProvider assigned to it.
This was a problem because I was using the AutoComplete to give the user some sort of code completion on a list of classes, and I had multiple instances of this AutoComplete component in my application. When the user used an AutoComplete component, the original collection used as the dataProvider was filtered which meant that any previously selected items in other AutoComplete instances had a good chance of being removed from the list.
You can see this in the example by selected ‘United Kingdom’ in the first AutoComplete component, then typing the letter ‘A’ in the second, and you’ll see that the first component no longer retains its selectedItem, as it is no longer in its dataProvider.
CollectionClone can be used to duplicate a collection before assigning it as a dataProvider, leaving the original dataProvider unfiltered, and only filtering the clone. It will keep an eye on the original collection for any changes, and make sure that they are all reflected in the cloned collection.
The source for CollectionClone and be downloaded from our Google Code repository