1 Reply Latest reply on Mar 1, 2010 1:35 PM by Gregory Lafrance

    using array in datagrid

    Alex-SM

      Hi,

       

      How can I display an array value in the datafield of a datagrid? i.e.,  code_name is 0 or 1 or 2. But I like to diplay "zero" or "one" or "two" in datagrid.

      the code below won't work.

       

       

      [Bindable] public  var code_nameArray:Array = ["zero","one","two"];
      ....



             <mx:DataGrid id="mydatagrid" dataProvider="mydata" width="100%" height="100%">
                <mx:columns>
                      <mx:DataGridColumn headerText="Policy Type" dataField="code_nameArray[code_name]" width="34"/>
                  </mx:columns>
              </mx:DataGrid>

       

       

      Thanks,

      AS

        • 1. Re: using array in datagrid
          Gregory Lafrance Level 6

          Use the labelFunction property of the DataGridColumn, and process the data in the function.

           

          If this post answers your question or helps, please mark it as such.


          Greg Lafrance - Flex 2 and 3 ACE certified

          www.ChikaraDev.com

          Flex / AIR Development, Training, and Support Services