3 Replies Latest reply on Sep 29, 2006 1:36 PM by ntsiii

    dataGrid + calculated Column

    ljonny18 Level 1
      Hi all,

      I am using a dataGrid to display information from a database…. data is retrieved from the database and is used to populate the dataGrid using a web service.

      I want to include a column within the database that performs a calculation, e.g.:

      <mx:DataGrid editable="true">
      <mx:columns>
      <mx:DataGridColumn id="a" dataField="a" headerText="A"/>
      <mx:DataGridColumn id="b" dataField="b" headerText="B"/>
      <mx:DataGridColumn id="c" dataField="c" headerText="C"/>
      <mx:DataGridColumn editable="false" id="sum" headerText="SUM"/>
      </mx:columns>
      </mx:DataGrid>

      in the “SUM” column of the dataGrid I want to add the valuuse of the other columns together and show the total (sum = a+b+c;)
      I want the colomns (a,b&c) to be editable so when a column is changed the “SUM” it automatically updated.

      Can I do this using the “change” property within the dataGrid calling an mx:Script function to process the calculations???

      Any suggestions of the best way to go about doing this?
      Thanks,
      Jon.