1 Reply Latest reply on Feb 19, 2012 1:58 PM by jhapak

    Same values in DataGrid causes selection problem

    jhapak

      Hi all,

      When I have a column in DataGrid with the same values, it only allows to select the last placed item. Is there any way to fix this problem. I am creating a new object everytime but I am now sure why DataGrid is giving problem.

       

       

      Thanks in advance. Below is the sample code:

       

       

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                     xmlns:s="library://ns.adobe.com/flex/spark"

                     xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

                     creationComplete="init()">

          <fx:Declarations>

              <!-- Place non-visual elements (e.g., services, value objects) here -->

          </fx:Declarations>

       

          <fx:Script>

              <![CDATA[

                  import mx.collections.ArrayCollection;

                  import mx.containers.Canvas;

       

                  [Bindable]

                  private var canvasList:ArrayCollection = new ArrayCollection();

       

                  private function init():void

                  {

                      var c:Canvas;

       

                      for (var i:int=0; i < 10; i++)

                      {

                          c = new Canvas();

                          c.name = "adsf";

                          canvasList.addItem(c);

                      }

                  }

       

              ]]>

          </fx:Script>

       

          <mx:DataGrid id="fillersDataGrid" dataProvider="{canvasList}">

              <mx:columns>

                  <mx:DataGridColumn dataField="name" headerText="Name"/>

              </mx:columns>

          </mx:DataGrid>

       

      </mx:Application>