2 Replies Latest reply on Apr 17, 2010 9:23 PM by Flex harUI

    Using array access index in DataGridColumn


      I would like to use two dimensional ArrayCollection as my DataProvider in DataGrid, e.g each row should consist of the following columns:


      CompanyName, productQuantity1, productQuantity2,...., productQuantityN


      where 'N' is some arbitrary number (thus I'm using ArrayCollection to store row data instead of Object). Then inside script I'm dynamically adding columns first time the View is rendered.


      However I don't know what should I use as "dataField". I tried:


                         var i:int;
                         for (i = 0; i < row.length; i++) {
                             var dgc:DataGridColumn = new DataGridColumn("[" + i + "]");

                             var cols:Array = dg.columns;
                             dg.columns = cols;


      but it looks that it doesn't work.