1 Reply Latest reply on Jun 19, 2008 7:12 AM by matthew horn

    array problem

    san00001
      Hi,
      I am having an array with elements 1,2,3.I want to display this values in adatagrid with 3 columns.if i provide the the arrray as dataprovider to datagrid the values are repeating for the three columns.I ant to display 1 in 1st column 2 in 2nd column and so on.pls help me

      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="rr()">
      <mx:Script>
      <![CDATA[
      import mx.collections.ArrayCollection;
      public function rr():void
      {
      var ss:Array = [1,2,3];
      ;
      dd.dataProvider =ss;
      }


      ]]>
      </mx:Script>
      <mx:DataGrid id="dd">
      <mx:columns >
      <mx:DataGridColumn headerText="Initial" dataField="a"/>
      <mx:DataGridColumn headerText="overdue" dataField="b"/>
      <mx:DataGridColumn headerText="pending" dataField="c"/>
      </mx:columns>
      </mx:DataGrid>
      </mx:Application>

        • 1. Re: array problem
          matthew horn Level 3
          Well, setting up the Array like this:

          var ss:Array = [{a:1},{b:2},{c:3}];

          Gets you part of the way, but it creates a new row for each entry. I think what you'll have to do is write a loop that creates DataGridColumns and populates the values manually.

          matt horn
          flex docs