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

    array problem

    san00001 Level 1
      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()">
      import mx.collections.ArrayCollection;
      public function rr():void
      var ss:Array = [1,2,3];
      dd.dataProvider =ss;

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

        • 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