That'll work, but I think setting selectedIndices will be much faster.
Var n:int = dataProvider.length;
Var arr:Array = new Array(n);
For (var i:int = 0; i < n; i++);
arr[i] = i;
selectedIndices = arr;
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Josh
McDonald
Sent: Thursday, November 20, 2008 2:56 PM
To: [email protected]
Subject: Re: [flexcoders] How to SelectAll entries in List
Code:
var all : Array;
if (myList.dataProvider is Array)
{
all = myList.dataProvider.concat();
}
else
{
all = [];
for (var o : * in myList.dataProvider)
{
all.push(o);
}
}
myList.selectedItems = all;
Note that you might want to use myList.dataProvider.source() if it's a
collection of some sort, but that could backfire when sorts or filters are
applied. It might not, I haven't checked through the source or tested it, but
it might. YMMV, etc :)
-Josh
On Fri, Nov 21, 2008 at 8:32 AM, anuj181 <[EMAIL PROTECTED]<mailto:[EMAIL
PROTECTED]>> wrote:
Hi Guys
In the list allowMultipleSelection allows me to select multiple
entries of the list box. How would i implement the 'Select All'
functionality, I need all the entries of the list to be selected if I
click on the button. Pls let me know
Thanks in advance
Anuj
------------------------------------
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Alternative FAQ location:
https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo!
Groups Links
--
"Therefore, send not to know For whom the bell tolls. It tolls for thee."
Like the cut of my jib? Check out my Flex blog!
:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]<mailto:[EMAIL PROTECTED]>
:: http://flex.joshmcdonald.info/
:: http://twitter.com/sophistifunk