4 Replies Latest reply on Jan 27, 2011 7:24 PM by saisri2k2

    Sum columns in datagrid

    jfb00 Level 3

      Hi All,

      I have a DG with multiple columns (Numbers), the values are coming from an array collection.

      What is the best way to sum couple columns? like

      Column01 + Column02 = ColumnTotal

       

      I try using a labelFuction in the column like:

      private function sumColumns(item:Object, col:DataGridColumn):String {
         var tempNumber:Number = parseFloat(item.column01) + parseFloat(item.column02);
         return tempNumber.toString();
      }
      

       

      But the result doesn't reflect in the arraycollection. Should I create the column with values at the time of received the results?

      If I do this, when I change the value in any of the columns 01 or 02 it doesn't change the total.

      Thanks for your help.

       

      Johnny