1 Reply Latest reply on Sep 19, 2006 3:04 AM by hsivaram

    datagrid display problem

    Pak_Sulis_Yang_Baik
      Hi all,
      I have encountered a frustrating problem. I'm using Flex 2.0 and want to display names and 18 digit id's in a datagrid from a HTTPService or from an ArrayCollection as follows
      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:DataGrid width="500" >
      <mx:ArrayCollection>
      <mx:Object>
      <mx:id>123456789123456789</mx:id>
      <mx:name>Peter</mx:name>
      </mx:Object>
      <mx:Object>
      <mx:id>123456789012345678</mx:id>
      <mx:name>Kristina</mx:name>
      </mx:Object>
      </mx:ArrayCollection>
      </mx:DataGrid>
      </mx:Application>

      but the datagrid did not show the id's as what I want.
      is this a bug or am I doing something silly?
      Can anybody help me to fix my problem?
        • 1. Re: datagrid display problem
          hsivaram
          You need to define your datagrid columns with the dateField property appropriately set. Also, ArrayCollection is not something that you use as a child of the DataGrid tag. Use the following code, It works as per your requirement.

          //--------------------------------------------------------------------------------------
          <?xml version="1.0"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
          <mx:DataGrid width="500" dataProvider="{myarr}">
          <mx:columns>
          <mx:DataGridColumn dataField="id"/>
          <mx:DataGridColumn dataField="name"/>
          </mx:columns>
          </mx:DataGrid>
          <mx:ArrayCollection id="myarr">
          <mx:Object>
          <mx:id>123456789123456789</mx:id>
          <mx:name>Peter</mx:name>
          </mx:Object>
          <mx:Object>
          <mx:id>123456789012345678</mx:id>
          <mx:name>Kristina</mx:name>
          </mx:Object>
          </mx:ArrayCollection>
          </mx:Application>

          Thanks
          Harish