To select all the items in myList I wrote:
myList.selectedItems = ['red','cyan','magenta'] ;
But what if I don't know about the items in the mx:list in advance? How can I select all the items in a list without specifying their names?
Thanks
To select all the items in myList I wrote:
myList.selectedItems = ['red','cyan','magenta'] ;
But what if I don't know about the items in the mx:list in advance? How can I select all the items in a list without specifying their names?
Thanks
You may have luck accessing the child ListBaseContentHolder of the mx.controls.List. I've never done this myself and don't have the moment to test it, but that should be the object that contains the children of the List.
You can use the selectedIndices property of the List component instead of the selectedItems property.
You should be able to loop through your dataset, pushing the indexes onto an array, then set selectedIndices to your array.
How about
myList.selectedItems = (myList.dataProvider as ArrayCollection).source
??
I haven't tried this, but I have a feeling that this should probably work.. !!