On Fri, 18 Mar 2005 20:17:25 -0000, dduuggllaa
<[EMAIL PROTECTED]> wrote:

> Rather simple really, I've got a data model fed from XML output Excel.
> The relevant bits look like:
> <Worksheet>
>         <Table>
>                 <Row>
>                 <Cell>
>                                 <Data>12.34</Data>
>                         </Cell>
>                         <Cell>
>                                 <Data>43.21</Data>
>                         </Cell>
>                 </Row>
[snip]

> What I want here is Workbook.Table.Row.Cell.Data containing: 12.34
> <mx:DataGridColumn columnName="???" headerText="some data 0"/>
> 
> What I want here is Workbook.Table.Row.Cell.Data containing: 43.21
> <mx:DataGridColumn columnName="???" headerText="some data 1"/>

You can create a new dataprovider from the original XML:

  <mx:Script>
    import mx.utils.ArrayUtil;

    function getDataProvider(m):Array
    {
      var rows:Array = ArrayUtil.toArray(m.Worksheet.Table.Row);
      var newRows:Array = new Array(rows.length);

      for (var i:Number = 0; i != rows.length; i++)
        newRows[i] = {left: rows[i].Cell[0].Data,
            right: rows[i].Cell[1].Data};

      return newRows;
    }
  </mx:Script>

  <mx:DataGrid dataProvider="{getDataProvider(excelModel)}" />

Manish


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to