1 Reply Latest reply on Jun 25, 2006 6:39 PM by leotemp

    How to Populate multi column datagrid

    leotemp Level 1
      I would like to populate a datagrid from my dynamic xml source. The datagrid is two collumns, the "name" collumn and the "id" collumn, my problem comes in when i try to get both the name and the id values from a single nested xml string rather then two seperate ones. What i get is a list in the first row of each collumn is a comman deliminated list like this "product 1, product 2, product 3,", do i need to convert this to an array? I would also like to be able to sort this grid but im not sure if thats done on the data side in my xml source with a particular "Tag" or what.. Examples are below:

      <name>product 1</name>
      <name>product 2</name>
      <name>product 3</name>
      <name>product 4</name>

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="400" height="300" creationComplete="getCat();changeCat('Tile')">

      <mx:HTTPService id="prodByCatStream"
      url=" http://localhost/rogerwilko/AndeanStone/xml.asp" method="post"/>

      <mx:DataGrid id="prodList" dataProvider="{mx.utils.ArrayUtil.toArray(this.prodByCatStream.lastResult.products)}" columnWidth="200" width="200" left="10" top="62" bottom="10" cornerRadius="2">
      <mx:DataGridColumn headerText="{prodCatList.value}" dataField="name"/>
      <mx:DataGridColumn headerText="PID" dataField="pid"/>


      Thanks alot to anyone willing to help!

        • 1. Re: How to Populate multi column datagrid
          leotemp Level 1
          Ok after reading 3 paragraphs from an XML pdf i realised how stupid my mistake was,

          by changing the xml output to this i fixed all my issues including the sort arrow error i was having.

          <name>Test 1</name>
          <name>Test 2</name>