4 Replies Latest reply on Oct 19, 2009 8:31 AM by msakrejda

    Number formatting not working.

    flexprad09 Level 2

      Hello All,


      I want to format particular column's value in DataGrid's Dataprovider to change there decimalseparator from "." to "."
      I have tried the code written below but is not working.
      values are still coming same.



      var nf:NumberBase = new NumberBase();
      nf.decimalSeparatorFrom = ".";nf.decimalSeparatorTo = ",";
      var myDG:DataGrid  // this is my Datagrid and is already populated
      var araycoll:ArrayCollection = ArrayCollection(myDG.dataProvider);  //my Datagrid's DP.
      var DGColumn:DGColumns;  //DGColumns is custom Class and contains info like column's name, type etc.
      for(var i:int=0;i<araycoll.length;i++)
           for each(DGColumn in myDataSource.columnArray)        //looping through column array just to find if type is numeric.
               if(DGColumn.columnType== "Numeric")
               nf.formatDecimal(String(araycoll[i][DGColumn.columnName])); //araycoll[i][DGColumn.columnName] is containing DG's cell value and is coming alrite
      myDG.dataProvider = araycoll;


      i have also tried nf.format() with NumberFormatter type.
      when i debug into ListCollectionView i see that its flooring the number.


      Any help or links on how to do it are appreciated.


      Or if there's any other shorter way to do this.


      Thanks a lot,