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
Hi everyone,
I have this problem trying to extract child nodes from an XMLDocument object, 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.nextSibling.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 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 .
--
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
| 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.

