<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Sorting and filtering data in an XMLListCollection</title>
	<atom:link href="http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Thu, 18 Mar 2010 20:18:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Geoff</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-793</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Fri, 03 Oct 2008 15:08:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-793</guid>
		<description>Another great example.  Many thanks!</description>
		<content:encoded><![CDATA[<p>Another great example.  Many thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-791</link>
		<dc:creator>peterd</dc:creator>
		<pubDate>Thu, 10 Apr 2008 04:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-791</guid>
		<description>northwebs.net/Sjoerd,

Does this answer your question at all? &lt;a href=&quot;http://blog.flexexamples.com/2008/04/09/creating-a-custom-sort-on-a-datagrid-control-in-flex/&quot; rel=&quot;nofollow&quot;&gt;&lt;u&gt;&quot;Creating a custom sort on a DataGrid control in Flex&quot;&lt;/u&gt;&lt;/a&gt;

Peter</description>
		<content:encoded><![CDATA[<p>northwebs.net/Sjoerd,</p>
<p>Does this answer your question at all? <a href="http://blog.flexexamples.com/2008/04/09/creating-a-custom-sort-on-a-datagrid-control-in-flex/" rel="nofollow"><u>&#8220;Creating a custom sort on a DataGrid control in Flex&#8221;</u></a></p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: northwebs.net</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-792</link>
		<dc:creator>northwebs.net</dc:creator>
		<pubDate>Wed, 09 Apr 2008 16:33:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-792</guid>
		<description>hello Peter :)

about sorting tree we can use @name for Sjoerd case?</description>
		<content:encoded><![CDATA[<p>hello Peter :)</p>
<p>about sorting tree we can use @name for Sjoerd case?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-790</link>
		<dc:creator>Shawn</dc:creator>
		<pubDate>Thu, 17 Jan 2008 14:28:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-790</guid>
		<description>I have been trying for days to get the XMLListCollection to filter and sort.

I am receiving this document from a web service in e4x and initialize my xmllistcollection as follows:


My xml looks like:








Where member 3 is a child of member 2 and member 2 is a child of member 1.  I have tried to apply the filter and the sort and nothing happens.  Here are my methods:
&lt;pre class=&quot;code&quot;&gt;
protected function sortItems():void
{
	var treeSort:Sort = new Sort();

	treeSort.fields = [new SortField(&quot;@id&quot;, true)];
	dataSource_Tree.sort = treeSort;
	dataSource_Tree.refresh();
}
protected function filterByColor():void
{
	dataSource_Tree.filterFunction = colorFilter;  //dataSource_Tree is XMLListCollection
	dataSource_LOSTree.refresh();
}

protected function colorFilter(item:Object):Boolean   // User selects a color by textbox
{
	return item.@color == &#039;blue&#039;;
}
&lt;/pre&gt;

I have traced several times and each time nothing happens to the xml.  no filter, no sort... nothing.  According to the Flex documentation, filterfunctions are supposed to traverse the entire xml document node by node, but when i trace the passed in item on the colorFilter I get the entire xml document.  And the colorFilter method only gets called once (with the full xml) instead of item by item.

Is there a different way I need to filter a tree with nested nodes?</description>
		<content:encoded><![CDATA[<p>I have been trying for days to get the XMLListCollection to filter and sort.</p>
<p>I am receiving this document from a web service in e4x and initialize my xmllistcollection as follows:</p>
<p>My xml looks like:</p>
<p>Where member 3 is a child of member 2 and member 2 is a child of member 1.  I have tried to apply the filter and the sort and nothing happens.  Here are my methods:</p>
<pre class="code">
protected function sortItems():void
{
	var treeSort:Sort = new Sort();

	treeSort.fields = [new SortField("@id", true)];
	dataSource_Tree.sort = treeSort;
	dataSource_Tree.refresh();
}
protected function filterByColor():void
{
	dataSource_Tree.filterFunction = colorFilter;  //dataSource_Tree is XMLListCollection
	dataSource_LOSTree.refresh();
}

protected function colorFilter(item:Object):Boolean   // User selects a color by textbox
{
	return item.@color == 'blue';
}
</pre>
<p>I have traced several times and each time nothing happens to the xml.  no filter, no sort&#8230; nothing.  According to the Flex documentation, filterfunctions are supposed to traverse the entire xml document node by node, but when i trace the passed in item on the colorFilter I get the entire xml document.  And the colorFilter method only gets called once (with the full xml) instead of item by item.</p>
<p>Is there a different way I need to filter a tree with nested nodes?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peterd</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-789</link>
		<dc:creator>peterd</dc:creator>
		<pubDate>Thu, 27 Sep 2007 06:42:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-789</guid>
		<description>Sjoerd,

Is that the entire XML that you want to sort, or is there more?

Peter</description>
		<content:encoded><![CDATA[<p>Sjoerd,</p>
<p>Is that the entire XML that you want to sort, or is there more?</p>
<p>Peter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sjoerd</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-788</link>
		<dc:creator>Sjoerd</dc:creator>
		<pubDate>Wed, 26 Sep 2007 09:10:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-788</guid>
		<description>What about a XML that looks like this:

&lt;pre class=&quot;code&quot;&gt;
&lt;test name=&quot;groupname&quot;&gt;
    &lt;test2 name=&quot;old&quot;&gt;bla1data&lt;/test2&gt;
    &lt;test3 name=&quot;new&quot;&gt;bla2data&lt;/test3&gt;
&lt;/test&gt;
&lt;/pre&gt;

What would the sortfunction look like?

&lt;pre class=&quot;code&quot;&gt;
private function sortXLC():void {
    var nameSort:Sort = new Sort();
    nameSort.fields = [new SortField(&quot;test.test2&quot;, true)]; // This wont work...

    factoryMethodsXLC.sort = nameSort;
    factoryMethodsXLC.refresh();
}
&lt;/pre&gt;

-Sjoerd</description>
		<content:encoded><![CDATA[<p>What about a XML that looks like this:</p>
<pre class="code">
&lt;test name="groupname"&gt;
    &lt;test2 name="old"&gt;bla1data&lt;/test2&gt;
    &lt;test3 name="new"&gt;bla2data&lt;/test3&gt;
&lt;/test&gt;
</pre>
<p>What would the sortfunction look like?</p>
<pre class="code">
private function sortXLC():void {
    var nameSort:Sort = new Sort();
    nameSort.fields = [new SortField("test.test2", true)]; // This wont work...

    factoryMethodsXLC.sort = nameSort;
    factoryMethodsXLC.refresh();
}
</pre>
<p>-Sjoerd</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mare</title>
		<link>http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/comment-page-1/#comment-787</link>
		<dc:creator>mare</dc:creator>
		<pubDate>Mon, 10 Sep 2007 19:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.flexexamples.com/2007/08/22/sorting-and-filtering-data-in-an-xmllistcollection/#comment-787</guid>
		<description>Helped. Thanks.</description>
		<content:encoded><![CDATA[<p>Helped. Thanks.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
