DataGrid allows Multiple Selection : DataGrid Selection « Grid « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Grid » DataGrid SelectionScreenshots 
DataGrid allows Multiple Selection
DataGrid allows Multiple Selection
        

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initApp();">
    <mx:Script>
    
    import mx.events.DragEvent;
    import mx.controls.Alert;
    import mx.collections.ArrayCollection;
    private function initApp():void {
        srcgrid.dataProvider = new ArrayCollection([
            {Artist:'A', Album:'AA', Price:1.99},
            {Artist:'B', Album:'BB', Price:1.99},
            {Artist:'C', Album:'CC', Price:1.99}
        ]);
        destgrid.dataProvider = new ArrayCollection([]);
    }
    public function dragDropHandler(event:DragEvent):void {
        var dragObj:Array= event.dragSource.dataForFormat("items"as Array;
        for (var i:Number = 0; i < dragObj.length; i++) {
            Alert.show(dragObj[i].Artist);
        }
    }
  
    </mx:Script>
    <mx:HBox>
       <mx:DataGrid id="srcgrid" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true">
           <mx:columns>
              <mx:DataGridColumn dataField="Artist" />
              <mx:DataGridColumn dataField="Album" />
              <mx:DataGridColumn dataField="Price" />
           </mx:columns>
       </mx:DataGrid>
       <mx:DataGrid id="destgrid" allowMultipleSelection="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" dragDrop="dragDropHandler(event);">
           <mx:columns>
             <mx:DataGridColumn dataField="Artist" />
             <mx:DataGridColumn dataField="Album" />
             <mx:DataGridColumn dataField="Price" />
           </mx:columns>
       </mx:DataGrid>
    </mx:HBox>
</mx:Application>

   
    
    
    
    
    
    
    
  
Related examples in the same category
1.Remove selected item from DataGridRemove selected item from DataGrid
2.Get selected index from DataGridGet selected index from DataGrid
3.Navigate to URL from DataGrid as selection changedNavigate to URL from DataGrid as selection changed
4.Handling a user interaction by passing the event object to a functionHandling a user interaction by passing the event object to a function
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.