<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Selecting multiple items in Flex List and DataGrid controls</title>
	<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/</link>
	<description>A bunch of examples for Adobe Flex and ActionScript</description>
	<pubDate>Tue, 06 Jan 2009 11:55:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Lev</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-16657</link>
		<author>Lev</author>
		<pubDate>Mon, 10 Nov 2008 19:11:34 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-16657</guid>
		<description>Peter,

Is it at all possible to have multiple selection without the Cntl button pressed; each item on the list when simply single-clicked toggles between being selected and not. (Imagine an array of vertically arranged checkBoxes looking like a list :) )

Thanks for a wonderful website - used it on numerous occasions.
-Lev</description>
		<content:encoded><![CDATA[<p>Peter,</p>
<p>Is it at all possible to have multiple selection without the Cntl button pressed; each item on the list when simply single-clicked toggles between being selected and not. (Imagine an array of vertically arranged checkBoxes looking like a list :) )</p>
<p>Thanks for a wonderful website - used it on numerous occasions.<br />
-Lev</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lance Pollard</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-15354</link>
		<author>Lance Pollard</author>
		<pubDate>Sun, 07 Sep 2008 17:50:16 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-15354</guid>
		<description>Hey Peter,

I love this website, I use it almost everyday.  99% of the stuff on this you can't find anywhere else.  Thanks so much.

Peace,
Lance</description>
		<content:encoded><![CDATA[<p>Hey Peter,</p>
<p>I love this website, I use it almost everyday.  99% of the stuff on this you can&#8217;t find anywhere else.  Thanks so much.</p>
<p>Peace,<br />
Lance</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Halfway there...</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12846</link>
		<author>Halfway there...</author>
		<pubDate>Wed, 21 May 2008 20:50:48 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12846</guid>
		<description>Thats swell (and easy), so how can you set more than one selected item using ActionScript?</description>
		<content:encoded><![CDATA[<p>Thats swell (and easy), so how can you set more than one selected item using ActionScript?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reda Makhchan</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12655</link>
		<author>Reda Makhchan</author>
		<pubDate>Tue, 13 May 2008 09:59:47 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12655</guid>
		<description>And About 'IndexOf' it works for a simple array yes, but I don't think it works in this case :(</description>
		<content:encoded><![CDATA[<p>And About &#8216;IndexOf&#8217; it works for a simple array yes, but I don&#8217;t think it works in this case :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reda Makhchan</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12654</link>
		<author>Reda Makhchan</author>
		<pubDate>Tue, 13 May 2008 09:55:38 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12654</guid>
		<description>hello Peter,

Sorry I spoke french, well what I want to say is :

I've an two arrays :

   
        
            
                
                
                
                
                
                
                ...
            
        
  

   
        
            
                
                
                
                
                
                
                ...
            
        
  


the first is affacted to dataprovider in a grdLigne (allowmultiSelect = true)
so I can select ligne 11, ligne 12 ... and I need to get the concerned value from a second array.

Ithink we get the selected value 1 by 1 with:
grdLigne.selectedItems[0].ligne,grdLigne.selectedItems[1].ligne ...

and I need to filter that array by selected lignes (filterFunc):
          
        ...
        arrCol2.filterFunction = processFilter;
        ...

        private function processFilter(item:Object):Boolean {
                //will not work
        	if(item.ligne == grdLigne.selectedItems.ligne) 
        		return true;
        	else return false;
        }
any idea?

that what I was talking about ;), sorry and thks in advance Peter</description>
		<content:encoded><![CDATA[<p>hello Peter,</p>
<p>Sorry I spoke french, well what I want to say is :</p>
<p>I&#8217;ve an two arrays :</p>
<p>                &#8230;</p>
<p>                &#8230;</p>
<p>the first is affacted to dataprovider in a grdLigne (allowmultiSelect = true)<br />
so I can select ligne 11, ligne 12 &#8230; and I need to get the concerned value from a second array.</p>
<p>Ithink we get the selected value 1 by 1 with:<br />
grdLigne.selectedItems[0].ligne,grdLigne.selectedItems[1].ligne &#8230;</p>
<p>and I need to filter that array by selected lignes (filterFunc):</p>
<p>        &#8230;<br />
        arrCol2.filterFunction = processFilter;<br />
        &#8230;</p>
<p>        private function processFilter(item:Object):Boolean {<br />
                //will not work<br />
        	if(item.ligne == grdLigne.selectedItems.ligne)<br />
        		return true;<br />
        	else return false;<br />
        }<br />
any idea?</p>
<p>that what I was talking about ;), sorry and thks in advance Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12646</link>
		<author>peterd</author>
		<pubDate>Mon, 12 May 2008 23:37:44 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12646</guid>
		<description>&lt;a href="http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12645" rel="nofollow"&gt;Reda Makhchan&lt;/a&gt;,

Sorry, I'm not sure I understand your question, but does this help?
&lt;pre class="code"&gt;
&#60;?xml version="1.0" encoding="utf-8"?&#62;
&#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&#62;

    &#60;mx:Script&#62;
        &#60;![CDATA[
            import mx.controls.Alert;
            import mx.events.ListEvent;

            private function list_change(evt:ListEvent):void {
                var item:String = "Four";
                var idx:int = list.selectedItems.indexOf(item);
                if (idx &#62; -1) {
                    Alert.show("Item was selected.", "index = " + idx);
                } else {
                    Alert.show("Item was not selected.");
                }
            }
        ]]&#62;
    &#60;/mx:Script&#62;

    &#60;mx:Array id="arr"&#62;
        &#60;mx:String&#62;One&#60;/mx:String&#62;
        &#60;mx:String&#62;Two&#60;/mx:String&#62;
        &#60;mx:String&#62;Three&#60;/mx:String&#62;
        &#60;mx:String&#62;Four&#60;/mx:String&#62;
        &#60;mx:String&#62;Five&#60;/mx:String&#62;
        &#60;mx:String&#62;Six&#60;/mx:String&#62;
        &#60;mx:String&#62;Seven&#60;/mx:String&#62;
        &#60;mx:String&#62;Eight&#60;/mx:String&#62;
    &#60;/mx:Array&#62;

    &#60;mx:List id="list"
            allowMultipleSelection="true"
            dataProvider="{arr}"
            labelField="col1"
            verticalScrollPolicy="on"
            width="100"
            change="list_change(event);" /&#62;

&#60;/mx:Application&#62;
&lt;/pre&gt;

Peter</description>
		<content:encoded><![CDATA[<p><a href="http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12645" rel="nofollow">Reda Makhchan</a>,</p>
<p>Sorry, I&#8217;m not sure I understand your question, but does this help?</p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.events.ListEvent;

            private function list_change(evt:ListEvent):void {
                var item:String = "Four";
                var idx:int = list.selectedItems.indexOf(item);
                if (idx &gt; -1) {
                    Alert.show("Item was selected.", "index = " + idx);
                } else {
                    Alert.show("Item was not selected.");
                }
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:String&gt;One&lt;/mx:String&gt;
        &lt;mx:String&gt;Two&lt;/mx:String&gt;
        &lt;mx:String&gt;Three&lt;/mx:String&gt;
        &lt;mx:String&gt;Four&lt;/mx:String&gt;
        &lt;mx:String&gt;Five&lt;/mx:String&gt;
        &lt;mx:String&gt;Six&lt;/mx:String&gt;
        &lt;mx:String&gt;Seven&lt;/mx:String&gt;
        &lt;mx:String&gt;Eight&lt;/mx:String&gt;
    &lt;/mx:Array&gt;

    &lt;mx:List id="list"
            allowMultipleSelection="true"
            dataProvider="{arr}"
            labelField="col1"
            verticalScrollPolicy="on"
            width="100"
            change="list_change(event);" /&gt;

&lt;/mx:Application&gt;
</pre>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reda Makhchan</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12645</link>
		<author>Reda Makhchan</author>
		<pubDate>Mon, 12 May 2008 17:56:36 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-12645</guid>
		<description>slt Peter,

juste une truc pour selectedItems c'est un array, c'est bien, mais comment je peut tester si une valeur string exist sur ce derniers?

&lt;pre class="code"&gt;
...
if(item.Idracine == myListe.grdLigne.selectedItems.Idracine)
...
&lt;/pre&gt;

merci d'avance pour ce site Peter :)</description>
		<content:encoded><![CDATA[<p>slt Peter,</p>
<p>juste une truc pour selectedItems c&#8217;est un array, c&#8217;est bien, mais comment je peut tester si une valeur string exist sur ce derniers?</p>
<pre class="code">
...
if(item.Idracine == myListe.grdLigne.selectedItems.Idracine)
...
</pre>
<p>merci d&#8217;avance pour ce site Peter :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Terence</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-4646</link>
		<author>Terence</author>
		<pubDate>Thu, 29 Nov 2007 18:54:49 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-4646</guid>
		<description>thank you. that worked :D</description>
		<content:encoded><![CDATA[<p>thank you. that worked :D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-4645</link>
		<author>peterd</author>
		<pubDate>Thu, 29 Nov 2007 18:42:21 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-4645</guid>
		<description>Terence,

You can use the &lt;code&gt;selectedItems&lt;/code&gt; property instead of &lt;code&gt;selectedItem&lt;/code&gt;.
The &lt;code&gt;selectedItems&lt;/code&gt; property returns an array of objects representing all the selected items.

For more information, see the &lt;code&gt;selectedItems&lt;/code&gt; property in the ListBase class in the &lt;a href="http://livedocs.adobe.com/labs/flex3/langref/mx/controls/listClasses/ListBase.html#selectedItems" rel="nofollow"&gt;&lt;u&gt;Flex documentation&lt;/u&gt;&lt;/a&gt;.

Hope that helps,
Peter</description>
		<content:encoded><![CDATA[<p>Terence,</p>
<p>You can use the <code>selectedItems</code> property instead of <code>selectedItem</code>.<br />
The <code>selectedItems</code> property returns an array of objects representing all the selected items.</p>
<p>For more information, see the <code>selectedItems</code> property in the ListBase class in the <a href="http://livedocs.adobe.com/labs/flex3/langref/mx/controls/listClasses/ListBase.html#selectedItems" rel="nofollow"><u>Flex documentation</u></a>.</p>
<p>Hope that helps,<br />
Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Terence</title>
		<link>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-4642</link>
		<author>Terence</author>
		<pubDate>Thu, 29 Nov 2007 17:24:33 +0000</pubDate>
		<guid>http://blog.flexexamples.com/2007/11/21/selecting-multiple-items-in-flex-list-and-datagrid-controls/#comment-4642</guid>
		<description>how do you obtain the multiple selected through event on change?

i know u can get 1 object through 

var selectedItem:Object=event.target.selectedItem;

how do u get all the objects that are selected?</description>
		<content:encoded><![CDATA[<p>how do you obtain the multiple selected through event on change?</p>
<p>i know u can get 1 object through </p>
<p>var selectedItem:Object=event.target.selectedItem;</p>
<p>how do u get all the objects that are selected?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
