Jeff,
That worked like a charm and saved me from some ugly code. Thanks!
On Apr 5, 2005 6:02 PM, Jeff Tapper <[EMAIL PROTECTED]> wrote:
>
> Try wrapping it with mx.utils.ArrayUtil.toArray()
>
> A single node in XML isnt neccessarily interpretted as an array, while
> multiple nodes of the same name are. However, you can use the static
> toArray method to treat the node as a 1 element array:
>
> ><mx:DataGrid id="moduleDatagrid"
> >dataProvider="{mx.utils.ArrayUtil.toArray(testModel.message)}" />
>
> At 07:37 PM 4/5/2005, you wrote:
> >1) I have searched the flexcoders group for an answer
> >2) I don't find this documented anywhere, but every example of a
> >datagrid has 2 or more nodes of data
> >
> >I have a datagrid with a dynamic datasource that contains from 0 to N
> >elements (they are XML nodes)
> >
> >It works fine as long as there is more than one node. If there is one
> >node I can't access the values in that node.
> >
> >I tested it with a static XML file with the same results. Here is the test:
> >
> ><mx:Model id="testModel" source="xml/test.xml" />
> ><mx:DataGrid id="moduleDatagrid" dataProvider="{testModel.message}" />
> >
> >Here is the XML that works:
> ><?xml version="1.0" encoding="utf-8"?>
> ><messages>
> > <message>
> > <viewdate>test date</viewdate>
> > </message>
> > <message>
> > <viewdate>test date 2</viewdate>
> > </message>
> ></messages>
> >
> >but if I modify the XML as follows, I cannot access the data in the
> >message node:
> ><?xml version="1.0" encoding="utf-8"?>
> ><messages>
> > <message>
> > <viewdate>test date</viewdate>
> > </message>
> ></messages>
> >
> >I am looking for an elegant way to display data in the datagrid and
> >wonder if anyone else has come across this
> >
> >
> >----------
> >Yahoo! Groups Links
> > * To visit your group on the web, go to:
> > *
> > <http://groups.yahoo.com/group/flexcoders/>http://groups.yahoo.com/group/flexcoders/
> >
> > *
> > * To unsubscribe from this group, send an email to:
> > *
> > <mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
> >
> > *
> > * Your use of Yahoo! Groups is subject to the
> > <http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>
> Yahoo! Groups Links
>
>
>
>
>
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/