In case you didn't know you can have multiple ArrayCollection with the same array as source. When you add to any of the collections or to the array, all the other collections will contain the new item. However, if you use databinding on the collection the events are not triggered when you add the item to another collection. Because of that you need to manually refresh each ArrayCollection.

You can see a demo here. Bellow you have the source code.


1.<?xml version="1.0" encoding="utf-8"?>
2.<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
3. layout="vertical"
4. creationComplete="onCreationComplete()">
5. <mx:Script>
6. <![CDATA[
7. import mx.collections.ArrayCollection;
8. public var theArray:Array = new Array();
9. [Bindable]
10. public var maleCollection:ArrayCollection = new ArrayCollection(theArray);
11. [Bindable]
12. public var femaleCollection:ArrayCollection = new ArrayCollection(theArray);
13. [Bindable]
14. public var allCollection:ArrayCollection = new ArrayCollection(theArray);
15. 
16. public function addEntry(_name:String, _type:String):void
17. {
18. this.allCollection.addItem({label:_name, gender:_type});
19. this.femaleCollection.refresh();
20. this.maleCollection.refresh();
21. }
22. 
23. public function filterMale(item:Object):Boolean
24. {
25. return item.gender == "Male";
26. }
27. 
28. public function filterFemale(item:Object):Boolean
29. {
30. return item.gender == "Female";
31. }
32. 
33. public function onCreationComplete():void
34. {
35. maleCollection.filterFunction = filterMale;
36. femaleCollection.filterFunction = filterFemale;
37. addEntry("Male 1", "Male");
38. addEntry("Female 1", "Female");
39. addEntry("Male 2", "Male");
40. addEntry("Female 2", "Female");
41. }
42. ]]>
43. </mx:Script>
44. 
45. <mx:Label text="Male"/>
46. <mx:List dataProvider="{maleCollection}"
47. width="300"/>
48. <mx:HRule width="200"/>
49. 
50. <mx:Label text="Female"/>
51. <mx:List dataProvider="{femaleCollection}"
52. width="300"/>
53. <mx:HRule width="200"/>
54. 
55. <mx:Label text="All"/>
56. <mx:List dataProvider="{allCollection}"
57. width="300"/>
58. <mx:HRule width="200"/>
59. 
60. <mx:Label text="Add new entry"/>
61. <mx:HBox>
62. <mx:TextInput id="entryName"
63. text="Name here"/>
64. <mx:ComboBox id="type">
65. <mx:dataProvider>
66. <mx:Object label="Male"/>
67. <mx:Object label="Female"/>
68. </mx:dataProvider>
69. </mx:ComboBox>
70. <mx:Button label="Add"
71. click="addEntry(entryName.text, type.selectedLabel)"/>
72. </mx:HBox>
73.</mx:Application>
74. 
Generated by FlexWebFormater