Search Flex Samples

Selecting multiple items in Flex List and DataGrid controls

The following example shows how you can have multiple selected items in a List or DataGrid control at the same time. To select multiple items at once, hold down the Shift or Control keys on your keyboard while pressing the mouse button on a list item.




<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

layout="horizontal"

verticalAlign="middle"

backgroundColor="white">

<mx:Array id="arr">

<mx:Object col1="One.1" col2="One.2" col3="One.3" />

<mx:Object col1="Two.1" col2="Two.2" col3="Two.3" />

<mx:Object col1="Three.1" col2="Three.2" col3="Three.3" />

<mx:Object col1="Four.1" col2="Four.2" col3="Four.3" />

<mx:Object col1="Five.1" col2="Five.2" col3="Five.3" />

<mx:Object col1="Six.1" col2="Six.2" col3="Six.3" />

<mx:Object col1="Seven.1" col2="Seven.2" col3="Seven.3" />

<mx:Object col1="Eight.1" col2="Eight.2" col3="Eight.3" />

</mx:Array>

<mx:ApplicationControlBar dock="true">

<mx:Form styleName="plain">

<mx:FormItem label="allowMultipleSelection:">

<mx:CheckBox id="checkBox" selected="true" />

</mx:FormItem>

</mx:Form>

</mx:ApplicationControlBar>

<mx:List id="list"

allowMultipleSelection="{checkBox.selected}"

dataProvider="{arr}"

labelField="col1"

verticalScrollPolicy="on" />

<mx:DataGrid id="dataGrid"

allowMultipleSelection="{checkBox.selected}"

dataProvider="{arr}"

verticalScrollPolicy="on" />

</mx:Application>

0 comments:

Related Flex Samples

Learn Flex: Flex Samples | Flex Video Tutorials Flex Examples