<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>中文Flex例子 &#187; sortCompareFunction</title>
	<atom:link href="http://blog.minidx.com/tag/sortcomparefunction/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.minidx.com</link>
	<description>中文Adobe Flex例子,Flex实例教程,RIA资源,全文检索技术,算法和数据结构</description>
	<lastBuildDate>Thu, 31 Mar 2011 03:22:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flex中通过扩展Label对DataGrid进行格式化显示的例子</title>
		<link>http://blog.minidx.com/2008/07/29/1179.html</link>
		<comments>http://blog.minidx.com/2008/07/29/1179.html#comments</comments>
		<pubDate>Mon, 28 Jul 2008 16:32:09 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[CurrencyFormatter]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[itemRenderer]]></category>
		<category><![CDATA[sortCompareFunction]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/07/29/1179.html</guid>
		<description><![CDATA[接下来的例子演示了Flex中如何通过扩展Label，对DataGrid进行格式化显示。例子中如果金额大小小于0，则红色显示，否则为黑色。注意标签是自定义的Label。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整实现代码(或点击这里察看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;!-- http://blog.flexexamples.com/2007/08/20/formatting-a-flex-datagrid-control-using-a-custom-item-renderer/ --&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;middle&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.controls.dataGridClasses.DataGridColumn;
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.utils.ObjectUtil;
&#160;
&#160; &#160; &#160; &#160; &#160; &#160; private&#160;function price_labelFunc(item:Object, column:DataGridColumn):String {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return&#160;currencyFormatter.format(item.@price);
&#160; &#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/07/29/1179.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex中如何对DataGrid的日期列进行排序的例子</title>
		<link>http://blog.minidx.com/2008/07/21/1103.html</link>
		<comments>http://blog.minidx.com/2008/07/21/1103.html#comments</comments>
		<pubDate>Sun, 20 Jul 2008 21:34:59 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[dataTipFunction]]></category>
		<category><![CDATA[dateCompare]]></category>
		<category><![CDATA[ObjectUtil]]></category>
		<category><![CDATA[showDataTips]]></category>
		<category><![CDATA[sortCompareFunction]]></category>
		<category><![CDATA[排序]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/07/21/1103.html</guid>
		<description><![CDATA[日期有很多格式，比如可以使YYYY-MM-DD,也可以使MM-DD-YYYY，如果是后一种的话，那么直接将其作为字符串来排序是不可以的。接下来的例子就演示了Flex中如何对DataGrid的日期列进行排序。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整代码(或点击这里察看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;middle&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; &#160; import mx.utils.ObjectUtil;
&#160;
&#160; &#160; &#160; &#160; &#160; &#160; private function date_sortCompareFunc(itemA:Object, itemB:Object):int {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; /* Date.parse() returns an int, but
&#160; &#160; &#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/07/21/1103.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex中如何将XML数据显示在DataGrid控件中的例子</title>
		<link>http://blog.minidx.com/2008/04/22/760.html</link>
		<comments>http://blog.minidx.com/2008/04/22/760.html#comments</comments>
		<pubDate>Mon, 21 Apr 2008 16:05:00 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[labelFunction]]></category>
		<category><![CDATA[sortCompareFunction]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XMLListCollection]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/04/22/760.html</guid>
		<description><![CDATA[接下来的例子演示了Flex在编译阶段，利用mx:XML将XML数据读入，并且将其在DataGrid控件中显示。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整代码(或点击这里察看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;top&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;&#160;&#160; 
&#160;
&#160; &#160; &#60;mx:XML&#160;id=&#34;tempXML&#34;
&#160; &#160; &#160; &#160; &#160; &#160; source=&#34;assets/cuePoints.xml&#34;&#160;/&#62;
&#160;
&#160; &#160; &#60;mx:XMLListCollection id=&#34;cuePointXMLList&#34;
&#160; &#160; &#160; &#160; &#160; &#160; source=&#34;{tempXML.CuePoint}&#34; /&#62;
&#160; &#160; &#60;mx:XMLListCollection&#160;id=&#34;parametersXMLList&#34;
&#160; &#160; &#160; &#160; &#160; &#160; source=&#34;{dataGrid.selectedItem.Parameters.Parameter}&#34;&#160;/&#62;&#160;&#160; 
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/04/22/760.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex中如何创建自定义排序DataGrid控件的例子</title>
		<link>http://blog.minidx.com/2008/04/10/699.html</link>
		<comments>http://blog.minidx.com/2008/04/10/699.html#comments</comments>
		<pubDate>Thu, 10 Apr 2008 15:24:52 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[compareFunction]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[descending]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sortCompareFunction]]></category>
		<category><![CDATA[SortField]]></category>
		<category><![CDATA[stringCompare]]></category>
		<category><![CDATA[排序]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/04/10/699.html</guid>
		<description><![CDATA[接下来的例子演示了如何利用SortField类以及自定义的比较函数，来创建可以自定义排序的DataGrid控件。
让我们先来看一下Demo（可以右键View Source或点击这里察看源代码）：









下面是完整代码(或点击这里察看)：
Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;middle&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.collections.SortField;
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.collections.Sort;
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.controls.dataGridClasses.DataGridColumn;
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.utils.ObjectUtil;
&#160;
&#160; &#160; &#160; &#160; &#160; &#160; private&#160;function sortOld():void {
&#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/04/10/699.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flex的DataGrid控件中如何实现数字以及区分/不区分大小写字母的排序的例子</title>
		<link>http://blog.minidx.com/2008/03/09/555.html</link>
		<comments>http://blog.minidx.com/2008/03/09/555.html#comments</comments>
		<pubDate>Sat, 08 Mar 2008 16:34:56 +0000</pubDate>
		<dc:creator>Minidxer</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[DataGridColumn]]></category>
		<category><![CDATA[NumericCompare]]></category>
		<category><![CDATA[ObjectUtil]]></category>
		<category><![CDATA[sortCompareFunction]]></category>
		<category><![CDATA[stringCompare]]></category>

		<guid isPermaLink="false">http://blog.minidx.com/2008/03/09/555.html</guid>
		<description><![CDATA[下面的例子展示了利用sortCompareFunction属性，静态的ObjectUtil.numericCompare() 和ObjectUtil.stringCompare()事件，通过设置DataGridColumn中的自定义的比较函数，来实现数字以及区分或者不区分大小写字母的排序。
下面是具体的程序代码：








Download: main.mxml&#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62;
&#60;!-- http://blog.flexexamples.com/2008/03/07/performing-case-insensitive-sorts-using-the-datagrid-control-in-flex/ --&#62;
&#60;mx:Application&#160;xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34;
&#160; &#160; &#160; &#160; layout=&#34;vertical&#34;
&#160; &#160; &#160; &#160; verticalAlign=&#34;middle&#34;
&#160; &#160; &#160; &#160; backgroundColor=&#34;white&#34;&#62;
&#160;
&#160; &#160; &#60;mx:Script&#62;
&#160; &#160; &#160; &#160; &#60;![CDATA[
&#160; &#160; &#160; &#160; &#160; &#160; import&#160;mx.utils.ObjectUtil;
&#160;
&#160; &#160; &#160; &#160; &#160; &#160; private&#160;function index_sortCompareFunc(itemA:Object, itemB:Object):int {
&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; // Make sure itemA has an &#34;index&#34; property.
&#160; [...]]]></description>
		<wfw:commentRss>http://blog.minidx.com/2008/03/09/555.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 3/27 queries in 0.215 seconds using disk
Object Caching 454/855 objects using disk

Served from: blog.minidx.com @ 2012-02-10 01:10:59 -->
