E4x is much simpler to navigate.
If so, don't specify the "Item." part of the reference, just the name of
the property:
<mx:DataGridColumn headerText="Item ID" dataField="ItemID" />
At least that was how it is was done in 1.5.
Tracy
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Charles
Sent: Monday, May 29, 2006 2:37 AM
To: [email protected]
Subject: [flexcoders] Re: Accessing child nodes from XMLDocument in a
datagrid
Hi JG,
Yes, I know my question is a little confusing. What I am really
trying to do is to get the commented code near the bottom to work.
What I mean is, when I uncomment those lines, and try to specify
those specific columns (i.e. to display Item.ItemId, Item.Title,
etc...), my datagrid becomes empty. I think it is because I am
trying to access the child nodes of the Item, such as the ItemId,
and the Title. I don't know how to do it properly. As you can see,
I've tried "Item.ItemId". I've also tried "firstChild.ItemId",
or "firstChild.firstChild", and even firstChild.nextSibling", but
all with the same result...nothing. I hope that clarifies my
problem. Thanks for the reply though!
Charles
--- In [email protected], "John Grden" <[EMAIL PROTECTED]> wrote:
>
> Hey Charles, I'm not totaly sure what you're after here: is it
sorting? or
> is it access to a specific row/column data? I see both questions
here :)
>
> for sorting, look at the mx.collections.Sort class. I just did
this 2 days
> ago based on the samples in the help file and it worked great.
>
> If I'm not mistaken, you're dealing with XMLList's at that point.
Have you
> tried accessing the attributes like this?
>
> myList.attribute("propertyName");
>
>
> Also, in a for..in loop, I had to do this to get the name:
>
> extProperties[items].name().localName
>
> That's the equivilant to using "items" string in a for(var
items:String in
> obj) loop. In an XMLList, "items" is an index - which is not very
helpful
> if you're after the typical name/value pair.
>
> I don't know if any of this helps, but thought I'd take a stab
>
> JG
>
> On 5/28/06, Charles <[EMAIL PROTECTED]> wrote:
> >
> > Hi everyone,
> >
> >
> >
> > I have this problem trying to extract child nodes from an
XMLDocumentobject, and displaying them in a datagrid. In my code, I
have a simple XML
> > string, which I turn into an XMLDocument object using
> > xml_object.parse(xml_string). That works fine. Now I want to
display the
> > relevant data items in a datagrid. So, I simply make a datagrid
and set the
> > xml object as the data provider, giving it the point where the
> > SearchResultItem tag starts, so that will be the array of
repeating
> > items. This also works, but not in the way I would like it to
appear. So I
> > tried to set the columns, however, when I do this, I get nothing
returned.
> > This is the block of commented code at the bottom of the
application. If
> > you can see what I'm trying to do, all I am doing is trying to
access the
> > child nodes of the Item, but it won't let me. Someone please
help
> > me...it's driving me nuts!
> >
> >
> >
> > The source and .swf files can be downloaded here, so you can see
just what
> > I'm talking about...
> >
> > < http://charles.abstractations.com/test.zip >
> >
> >
> >
> > Here is my code...
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> > creationComplete="ParseXML()">
> > <mx:Script>
> > <![CDATA[
> > import flash.xml.XMLDocument;
> >
> > [Bindable] public var xml_object:XMLDocument = new
XMLDocument;
> > [Bindable] public var xml_string:String =
> > "<?xml version='1.0' encoding='UTF-8' ?>" +
> > "<GetSearchResultsResponse>" +
> > " <Timestamp>2006-05-26T16:34:26.994Z</Timestamp> " +
> > " <Ack>Success</Ack> " +
> > " <SearchResultItemArray>" +
> > " <SearchResultItem>" +
> > " <Item>" +
> > " <ItemID>110000084705</ItemID> " +
> > " <Title>Halo 2 for Xbox</Title>" +
> > " <Details>" +
> > " <Info>Like new, includes instruction manual</Info>" +
> > " </Details>" +
> > " </Item>" +
> > " <SearchResultValues>New</SearchResultValues> " +
> > " </SearchResultItem>" +
> > " <SearchResultItem>" +
> > " <Item>" +
> > " <ItemID>110000084752</ItemID> " +
> > " <Title>Halo 1 for Xbox</Title> " +
> > " <Details>" +
> > " <Info>Minor scratches, plays perfectly</Info>" +
> > " </Details>" +
> > " </Item>" +
> > " <SearchResultValues>New</SearchResultValues> " +
> > " </SearchResultItem>" +
> > " </SearchResultItemArray>" +
> > " <ItemsPerPage>100</ItemsPerPage> " +
> > " <PageNumber>1</PageNumber> " +
> > " <HasMoreItems>false</HasMoreItems> " +
> > " </GetSearchResultsResponse>";
> >
> > public function ParseXML():void
> > {
> > xml_object.ignoreWhite=true;
> > xml_object.parseXML(xml_string);
> >
> >
> >
search_results_grid.dataProvider=xml_object.firstChild.firstChild.nex
tSibling.nextSibling.childNodes;
> > }
> > ]]>
> > </mx:Script>
> >
> > <mx:DataGrid id="search_results_grid" height="400" width="100%"
> > selectedIndex="0" >
> > <!--
> > <mx:columns>
> > <mx:DataGridColumn headerText="Item ID"
dataField="Item.ItemID" />
> > <mx:DataGridColumn headerText="Title" dataField="Item.Title"
> > width="175" />
> > <mx:DataGridColumn headerText="Details"
dataField="Item.Details.Info"
> > width="175" />
> > </mx:columns>
> > -->
> > </mx:DataGrid>
> > <mx:Spacer height="15" />
> >
> > </mx:Application>
> >
> > Thanks in advance!
> >
> >
> > --
> > Flexcoders Mailing List
> > FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives: http://www.mail-archive.com/flexcoders%
40yahoogroups.com
> >
> >
> >
> > SPONSORED LINKS
> > Web site design development<http://groups.yahoo.com/gads?
t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=
Computer+software+development&w3=Software+design+and+development&w4=M
acromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig=L
-4QTvxB_quFDtMyhrQaHQ> Computer
> > software development<http://groups.yahoo.com/gads?
t=ms&k=Computer+software+development&w1=Web+site+design+development&w
2=Computer+software+development&w3=Software+design+and+development&w4
=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.sig
=lvQjSRfQDfWudJSe1lLjHw> Software
> > design and development<http://groups.yahoo.com/gads?
t=ms&k=Software+design+and+development&w1=Web+site+design+development
&w2=Computer+software+development&w3=Software+design+and+development&
w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166&.s
ig=1pMBCdo3DsJbuU9AEmO1oQ> Macromedia
> > flex<http://groups.yahoo.com/gads?
t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Computer+sof
tware+development&w3=Software+design+and+development&w4=Macromedia+fl
ex&w5=Software+development+best+practice&c=5&s=166&.sig=OO6nPIrz7_EpZ
I36cYzBjw> Software
> > development best practice<http://groups.yahoo.com/gads?
t=ms&k=Software+development+best+practice&w1=Web+site+design+developm
ent&w2=Computer+software+development&w3=Software+design+and+developme
nt&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=166
&.sig=f89quyyulIDsnABLD6IXIw>
> > ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> > - Visit your
group "flexcoders<http://groups.yahoo.com/group/flexcoders>"
> > on the web.
> >
> > - To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]<flexcoders-
[EMAIL PROTECTED]>
> >
> > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> > ------------------------------
> >
>
>
>
> --
> John Grden - Blitz
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

