Link to home
Start Free TrialLog in
Avatar of eduardo12fox
eduardo12foxFlag for Brazil

asked on

Sum column DataGrid

Hello,

Personally I have a DataGrid, and this data grid contains some fields, I would like to modify or enter a value in column "Quantity2" I automatically calculate Quantity2 + Price column and return the value in column "Result" how could I make it friends?



<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
   initialize="initData()">
   <mx:Script>
   <![CDATA[
   	import mx.controls.Alert;
      import mx.collections.*;
      private var DGArray:Array = [
         {Artist:'Pavement', Album:'Slanted and Enchanted', Price:10},
         {Artist:'Pavement', Album:'Brighten the Corners', Price:20}];
         
      [Bindable]
      public var initDG:ArrayCollection;
      public function initData():void {
         initDG=new ArrayCollection(DGArray);
      }
      
      
      
      
   ]]>
   </mx:Script>

   <mx:DataGrid id="myGrid" width="350" height="200"  dataProvider="{initDG}" editable="true" >
      <mx:columns>
         <mx:DataGridColumn dataField="Album"  editable="false" />
         <mx:DataGridColumn dataField="Price"  editable="false" />
         <mx:DataGridColumn dataField="Quantity2"  editable="true"/>
         <mx:DataGridColumn dataField="Result"  editable="false" />
      </mx:columns> 
   </mx:DataGrid>
</mx:Application>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eduardo12fox

ASKER

Very good! Thanks
You're welcome.
Thanx 4 axxepting