2

Am having an issue with combobox duplications i have 10 autocomplete comboboxes with all having same dataprovider... suppose like this array collection

public var costCenter:ArrayCollection = new
    ArrayCollection(["1101","1111","1121","1131","1141","1151", 
        "1161","1171","1181","1191"]);

if 1st combobox is selected with 1131 then that shouldnt be there in next comboboxes dataprovider. that is already selected items should be removed from collection for dataprovider and user can select 1st any of the 10 comboboxes

am making a copy of collection and using that collection as dataprovider for all comboboxes.. how to remove the already selected items from collection? any ideas? Thanks.

splash
  • 13,037
  • 1
  • 44
  • 67
vardit
  • 29
  • 6

2 Answers2

3

You can use filterFunction on you ArrayCollection instances and call refresh() on them after selecting values. But all the collections should be different instances from the single Array as a source.

Constantiner
  • 14,231
  • 4
  • 27
  • 34
  • I'm not sure that would work properly since what would you be filtering exactly, which one is selected in *all* comboboxes? What happens when the current combobox selects one and it gets filtered out? it would be removed from the combobox that just selected it... – J_A_X May 12 '11 at 14:54
  • I mean performing refreshing of all data providers on changing any combo box selection. – Constantiner May 12 '11 at 14:58
  • ah, that would work as long as he has a different filterFunction for each collection. – J_A_X May 12 '11 at 15:04
  • Yes. One `filterFunction` per collection. – Constantiner May 12 '11 at 16:24
  • what if it is xmllistcollection instead of array collection? –  May 24 '11 at 06:24
  • I suppose there shouldn't be any problem with different `XMLListCollection` initialized with the same `XMLList`. – Constantiner May 24 '11 at 11:29
0

The best way to do it is to remove the items from selectedIndices if you are doing version 3.x then you can just do something like comboBox.selectedIndex = -1, but in 4.x you have to do something like comboBox.selectedIndices = new Vector.<int>().

j0k
  • 22,600
  • 28
  • 79
  • 90
Luis
  • 1