4 Replies Latest reply on Oct 28, 2009 4:08 AM by flexprad09

    AdvancedDataGrid Column formatter change programmatically


      Hi All,


      I wanna change my ADG Column formatter at runtime through Action script for some numeric columns.

      I have written below code but nothing is displayed in ADG. [I think i am missing some thing]

      When i edit the cell, values are there. But then its unformatted as it should be. So i am not able to determine whether formatting is done or not.


      Please if anyone has done or know tell me what am i mising or if its altogether wrong.






      private var groupedColumnsArray:Array;


      for each(MyDataSourceColumn in MyDataSource.columnArray)   //this is my custom thing, insignificant for question
                          for each(var ADGColumn:AdvancedDataGridColumn in myDataGrid.groupedColumns)    //these are ADG columns
                                  if(MyDataSourceColumn.columnType== "Numeric")
                                  ADGColumn.formatter = nf;                                     // here am changing the column formatter , now i dont know how apply to ADG
                  myDataGrid.groupedColumns = groupedColumnsArray;
                  myDataGrid.invalidateDisplayList();                                     //is this really required here..


      How AdvancedDataGrid is looking is attached.

        • 1. Re: AdvancedDataGrid Column formatter change programmatically
          _Natasha_ Level 4



          check error property of your formatter. If output is empty, may be it's a error of formatter.

          1 person found this helpful
          • 2. Re: AdvancedDataGrid Column formatter change programmatically
            flexprad09 Level 2

            Hi Natasha,


            Thanks for REply.


            formatter.error is showing Null while tracing. So that means formatter is getting updated. I had seen through debug also. formatter is being assigned to ADG.columns.

            So now Just the thing is that cell's data is not visible in ADG.


            Can you interpret from last info as to how thats happening.

            If you need any other inputs i can give here.


            After we Update display properties of Dg or ADG i dont have much info about what these functions do

            validateNow() , validateProperties , validateDisplayList();

            Do you think i have to use any one of these .

            Or i may have some custom logical problem in code .


            Thanks & Regards,



            • 3. Re: AdvancedDataGrid Column formatter change programmatically
              _Natasha_ Level 4

              Have you tried to set formatter in mxml? (just for test)


              Do you use default formatter or your own?

              • 4. Re: AdvancedDataGrid Column formatter change programmatically
                flexprad09 Level 2

                When I UpLoad a Datasource in My ADG. I Actually Ask User to select his decimal and thousand separator and then when i create columns programmaticaly [action script] i assign formatter with that format. Its Working Fine . So actually mxml not involved from start till end.

                But After data being uploaded I have a Button where He/She can Switch to other format both decimal and thousandsseparator.

                Now here formatter is switched and is not displaying data in ADG.


                var nf:NumberFormatter = new NumberFormatter();

                nf.decimalSeparatorFrom = ".";nf.decimalSeparatorTo = ",";nf.thousandsSeparatorTo = "."


                and then code which i posted in first post.


                Formatter is default just properties being changed and then applied.