<?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: Default Sorting for a Flex DataGrid</title>
	<atom:link href="http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/</link>
	<description>BealeARTS - Information Ingenuity</description>
	<lastBuildDate>Sun, 08 Jan 2012 11:53:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: cirxesoul</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-26387</link>
		<dc:creator>cirxesoul</dc:creator>
		<pubDate>Tue, 17 May 2011 17:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-26387</guid>
		<description>Awesome! Thanks.</description>
		<content:encoded><![CDATA[<p>Awesome! Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hectorzeta</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-26385</link>
		<dc:creator>hectorzeta</dc:creator>
		<pubDate>Wed, 11 May 2011 10:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-26385</guid>
		<description>Great and simple solution. 
Just one side note, if you change the dataprovider of the datagrid the sorting will be lost. In order to avoid this you can use a ListCollectionView as the dataprovider of the datagrid and assign your ArrayCollection data to the &#039;list&#039; property of the ListCollectionView. Then if you need to change the dataprovider you only modify the list property and the dataprovider of the datagrid is not reset, and the sort is preserved.</description>
		<content:encoded><![CDATA[<p>Great and simple solution.<br />
Just one side note, if you change the dataprovider of the datagrid the sorting will be lost. In order to avoid this you can use a ListCollectionView as the dataprovider of the datagrid and assign your ArrayCollection data to the &#8216;list&#8217; property of the ListCollectionView. Then if you need to change the dataprovider you only modify the list property and the dataprovider of the datagrid is not reset, and the sort is preserved.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tashu</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-26379</link>
		<dc:creator>Tashu</dc:creator>
		<pubDate>Thu, 13 Jan 2011 14:42:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-26379</guid>
		<description>It worked :)</description>
		<content:encoded><![CDATA[<p>It worked <img src='http://www.bealearts.co.uk/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rakesh</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-9461</link>
		<dc:creator>Rakesh</dc:creator>
		<pubDate>Thu, 30 Sep 2010 22:22:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-9461</guid>
		<description>Hi,
I want to sort a coulmn of a datagrid, by using predefined values..
i have values in datagridcolumn like ( ? , ! , *, *!, !?, *?...)

AND I WANT TO SORT THE GRID VALUE IN THE ORDER ( ! , *! ,!? , ? , *? , * )
cAN YOU GUYS HELP ME OUT..</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I want to sort a coulmn of a datagrid, by using predefined values..<br />
i have values in datagridcolumn like ( ? , ! , *, *!, !?, *?&#8230;)</p>
<p>AND I WANT TO SORT THE GRID VALUE IN THE ORDER ( ! , *! ,!? , ? , *? , * )<br />
cAN YOU GUYS HELP ME OUT..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-3081</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Thu, 29 Jul 2010 03:23:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-3081</guid>
		<description>This neat hack is totally unnecessary if you use an instance of ListCollectionView as your dataProvider because you can accomplish this by setting the sort property of your collection as shown below. Your suggestion would also reset the sort column if/when data is reloaded from the server.  Thus you should create your collection and set the default sort field during initialization, then populate your collection anytime data is loaded from an external source, which will preserve the user&#039;s chosen sort columns when data is reloaded.

However, I&#039;ve found that if you have to set a custom sort function, then the DataGrid and AdvancedDataGrid doesn&#039;t show the ascending/descending marker by default even though the data is properly sorted.  I tried your suggestion to see if it would resolve my issue, but unfortunately it does not work either.

[code]

import mx.collections.Sort;
import mx.collections.SortField;
import mx.collections.XMLListCollection;

private accounts:XMLListCollection;
private function init():void {	
   accounts = new XMLListCollection();
   accounts.sort = new Sort();
   accounts.sort.fields = [new SortField(&quot;name&quot;, true, false, false)];
   accounts.refresh();
}

[/code]

If you want to try an awesome data grid, go to http://flexicious.com/Home/Demo.</description>
		<content:encoded><![CDATA[<p>This neat hack is totally unnecessary if you use an instance of ListCollectionView as your dataProvider because you can accomplish this by setting the sort property of your collection as shown below. Your suggestion would also reset the sort column if/when data is reloaded from the server.  Thus you should create your collection and set the default sort field during initialization, then populate your collection anytime data is loaded from an external source, which will preserve the user&#8217;s chosen sort columns when data is reloaded.</p>
<p>However, I&#8217;ve found that if you have to set a custom sort function, then the DataGrid and AdvancedDataGrid doesn&#8217;t show the ascending/descending marker by default even though the data is properly sorted.  I tried your suggestion to see if it would resolve my issue, but unfortunately it does not work either.</p>
<p>[code]</p>
<p>import mx.collections.Sort;<br />
import mx.collections.SortField;<br />
import mx.collections.XMLListCollection;</p>
<p>private accounts:XMLListCollection;<br />
private function init():void {<br />
   accounts = new XMLListCollection();<br />
   accounts.sort = new Sort();<br />
   accounts.sort.fields = [new SortField("name", true, false, false)];<br />
   accounts.refresh();<br />
}</p>
<p>[/code]</p>
<p>If you want to try an awesome data grid, go to <a href="http://flexicious.com/Home/Demo" rel="nofollow">http://flexicious.com/Home/Demo</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-232</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Wed, 21 Jul 2010 20:18:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-232</guid>
		<description>Thank you so much! That&#039;s a perfect little snippet I pasted right into my code.</description>
		<content:encoded><![CDATA[<p>Thank you so much! That&#8217;s a perfect little snippet I pasted right into my code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adeb</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-209</link>
		<dc:creator>adeb</dc:creator>
		<pubDate>Tue, 13 Jul 2010 11:13:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-209</guid>
		<description>Thanks a lot</description>
		<content:encoded><![CDATA[<p>Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Heimburg</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-202</link>
		<dc:creator>Eric Heimburg</dc:creator>
		<pubDate>Mon, 05 Jul 2010 03:54:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-202</guid>
		<description>Just wanted to say thanks for this, too. Bizarre that this is not a built-in feature, though...</description>
		<content:encoded><![CDATA[<p>Just wanted to say thanks for this, too. Bizarre that this is not a built-in feature, though&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Lira</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-191</link>
		<dc:creator>David Lira</dc:creator>
		<pubDate>Tue, 22 Jun 2010 12:04:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-191</guid>
		<description>You can define the first sort like ASC or DESC setting the propertie sortDescending in datagrid. True for descending or false for ascending. I think that is a better solution than dispatch two events.</description>
		<content:encoded><![CDATA[<p>You can define the first sort like ASC or DESC setting the propertie sortDescending in datagrid. True for descending or false for ascending. I think that is a better solution than dispatch two events.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pratik</title>
		<link>http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/comment-page-1/#comment-175</link>
		<dc:creator>Pratik</dc:creator>
		<pubDate>Thu, 20 May 2010 15:21:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.bealearts.co.uk/blog/2007/06/15/default-sorting-for-a-flex-datagrid/#comment-175</guid>
		<description>Thanks....it really helped n what a cool way to do that !</description>
		<content:encoded><![CDATA[<p>Thanks&#8230;.it really helped n what a cool way to do that !</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.387 seconds -->

