Get data from DataGrid in drag enter event : DataGrid Data « Grid « Flex






Get data from DataGrid in drag enter event

Get data from DataGrid in drag enter event
       
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.collections.ArrayCollection;
        import mx.events.DragEvent;
        import mx.managers.DragManager;
        [Bindable]
        public var myAC:ArrayCollection = new ArrayCollection([
            {name:"A", email:"a@domain.com", isActive:true},
            {name:"B", email:"b@domain.com", isActive:false},
            {name:"C", email:"c@domain.com", isActive:true}]);
            
        public function handleDragEnter(event:DragEvent):void
        {
            var arItems:Array= event.dragSource.dataForFormat("items") as Array;
            for (var i:int = 0; i < arItems.length; i++){
                trace(arItems[i].isActive);
            }    
        }
      
    </mx:Script>
    <mx:DataGrid id="dgSource" dataProvider="{myAC}" dragEnabled="true"
        dragMoveEnabled="true">
        <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Contact Name" width="300" />
            <mx:DataGridColumn dataField="email" headerText="E-Mail" width="200" />
            <mx:DataGridColumn dataField="isActive" headerText="Active" width="75" />
        </mx:columns>
    </mx:DataGrid>
    <mx:DataGrid id="dgTarget" dropEnabled="true" dragEnter="handleDragEnter(event)">
        <mx:columns>
            <mx:DataGridColumn dataField="name" headerText="Contact Name" width="300" />
            <mx:DataGridColumn dataField="email" headerText="E-Mail" width="200" />
            <mx:DataGridColumn dataField="isActive" headerText="Active" width="75" />
        </mx:columns>
    </mx:DataGrid>
</mx:Application>

   
    
    
    
    
    
    
  








Related examples in the same category

1.Fill data from DataGrid to Form fieldsFill data from DataGrid to Form fields
2.Update data in DataGrid from Form fieldsUpdate data in DataGrid from Form fields
3.ArrayCollection used as the data source for DataGridArrayCollection used as the data source for DataGrid
4.Inline data provider for DataGridInline data provider for DataGrid
5.Passing data to a DataGrid controlPassing data to a DataGrid control
6.Get data from selected row in DataGridGet data from selected row in DataGrid
7.Get DataGrid data providerGet DataGrid data provider
8.Remove data from DataGridRemove data from DataGrid
9.Get the returning data from Php and feed it into DataGridGet the returning data from Php and feed it into DataGrid
10.Update Chart data as DataGrid being updatedUpdate Chart data as DataGrid being updated
11.Modifying data in a DataGrid controlThe following example lets you add, remove, or modify data in a DataGrid controlModifying data in a DataGrid controlThe following example lets you add, remove, or modify data in a DataGrid control
12.DataGrid data with Simple AttributesDataGrid data with Simple Attributes
13.DataGrid and DataGrid and <mx:ArrayCollection>
14.DataGrid with object array collectionDataGrid with object array collection
15.Define array with Array collection in ActionScript and use it for DataGridDefine array with Array collection in ActionScript and use it for DataGrid