| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- saved from url=(0014)about:internet --><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><link rel="stylesheet" href="../../style.css" type="text/css" media="screen"><link rel="stylesheet" href="../../print.css" type="text/css" media="print"><link rel="stylesheet" href="../../override.css" type="text/css"><meta name="keywords" content="SortField,spark.collections.SortField,ANY_INDEX_MODE,FIRST_INDEX_MODE,LAST_INDEX_MODE,arraySortOnOptions,className,className,className,compareFunction,id,id,inheritingStyles,inheritingStyles,length,maximum,minimum,moduleFactory,moduleFactory,nameParts,nonInheritingStyles,nonInheritingStyles,stepSize,styleDeclaration,styleDeclaration,styleManager,styleManager,styleName,styleName,styleParent,styleParent,addItem,addItemAt,clearStyle,clearStyle,createEmptySortField,getClassStyleDeclarations,getClassStyleDeclarations,getClassStyleDeclarations,getItemAt,getItemIndex,getSortFieldValue,getStyleImpl,getStyle,getStyle,getStyle,hasCSSState,hasCSSState,initialized,initialized,initialized,itemUpdated,matchesCSSState,matchesCSSState,matchesCSSType,matchesCSSType,matchesCSSType,notifyStyleChangeInChildren,notifyStyleChangeInChildren,objectHasSortField,regenerateStyleCache,regenerateStyleCache,regenerateStyleCache,registerEffects,registerEffects,removeAll,removeItem,removeItemAt,setDeferredStyles,setItemAt,setStyleImpl,setStyle,setStyle,setStyle,stringCompare,styleChangedImpl,styleChanged,styleChanged,styleChanged,stylesInitialized,stylesInitialized,toArray,xmlCompare"><title>spark.collections.SortField</title><script src="../../AC_OETags.js" type="text/javascript"></script></head><body><script language="javascript" type="text/javascript" src="../../asdoc.js"></script><script language="javascript" type="text/javascript" src="../../help.js"></script><script language="javascript" type="text/javascript" src="../../cookies.js"></script><script language="javascript" type="text/javascript"><!-- |
| asdocTitle = 'SortField - ApacheFlex API Reference'; |
| var baseRef = '../../'; |
| window.onload = configPage; |
| --></script> |
| <script type="text/javascript"> |
| scrollToNameAnchor(); |
| </script><table class="titleTable" cellpadding="0" cellspacing="0" id="titleTable" style="display:none"><tr><td class="titleTableTitle" align="left">Apache Flex 4.16.1 API Reference </td><td class="titleTableTopNav" align="right"><a href="../../package-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Packages</a> | <a href="../../class-summary.html" onclick="loadClassListFrame('../../all-classes.html')">All Classes</a> | <a href="../../all-index-A.html" onclick="loadClassListFrame('../../index-list.html')">Index</a> | <a id="framesLink1" href="../../index.html?spark/collections/SortField.html&spark/collections/class-list.html">Frames</a><a id="noFramesLink1" style="display:none" href="" onclick="parent.location=document.location"> No Frames </a></td><td class="titleTableLogo" align="right" rowspan="3"><img src="../../images/logo.jpg" class="logoImage" alt="AdobeLogo" title="AdobeLogo"></td></tr><tr class="titleTableRow2"><td class="titleTableSubTitle" id="subTitle" align="left">SortField</td><td class="titleTableSubNav" id="subNav" align="right"><a href="#propertySummary">Properties</a> | <a href="#methodSummary">Methods</a> | <a href="#styleSummary">Styles</a> | <a href="#includeExamplesSummary">Examples</a></td></tr><tr class="titleTableRow3"><td colspan="3"> </td></tr></table><script language="javascript" type="text/javascript" xml:space="preserve"> |
| <!-- |
| |
| if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("SortField"); titleBar_setSubNav(false,true,true,false,false,false,false,false,true,true,false ,false,false,false,false,false);} |
| --> |
| </script><div xmlns:fn="http://www.w3.org/2005/xpath-functions" class="MainContent"><table class="classHeaderTable" cellpadding="0" cellspacing="0"><tr><td class="classHeaderTableLabel">Package</td><td><a href="package-detail.html" onclick="javascript:loadClassListFrame('class-list.html')">spark.collections</a></td></tr><tr><td class="classHeaderTableLabel">Class</td><td class="classSignature">public class SortField</td></tr><tr><td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">SortField <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> <a href="../../mx/collections/SortField.html">SortField</a> <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> flash.events.EventDispatcher</td></tr><tr><td class="classHeaderTableLabel">Implements</td><td> <a href="../../mx/styles/IAdvancedStyleClient.html">IAdvancedStyleClient</a>, <a href="../../mx/core/IFlexModule.html">IFlexModule</a>, <a href="../../mx/core/IMXMLObject.html">IMXMLObject</a></td></tr><tr><td class="classHeaderTableLabel">Subclasses</td><td> <a href="../../spark/collections/ComplexSortField.html">ComplexSortField</a>, <a href="../../spark/components/gridClasses/GridSortFieldSimple.html">GridSortFieldSimple</a></td></tr></table><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>Flex 4.5</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>Flash Player 10.1, AIR 2.5</td></tr></table><p></p><p></p><p></p><p></p> |
| Provides the sorting information required to establish a sort on a field |
| or property in a collection view. |
| The SortField class is meant to be used with the Sort class. |
| Typically the sort is defined for collections of complex items, that |
| is items in which the sort is performed on properties of those objects. |
| As in the following example: |
| <pre> |
| <code> |
| var col:ICollectionView = new ArrayCollection(); |
| col.addItem({first:"Anders", last:"Dickerson"}); |
| var sort:Sort = new Sort(); |
| var sortfield:SortField = new SortField("first", true); |
| sortfield.setStyle("locale", "en-US"); |
| sort.fields = [sortfield]; |
| col.sort = sort; |
| </code> |
| </pre> |
| There are situations in which the collection contains simple items, like |
| <code>String</code>, <code>Date</code>, <code>Boolean</code>, etc. |
| In this case, sorting should be applied to the simple type directly. |
| When constructing a sort for this situation only a single sort field is |
| required and should not have a <code>name</code> specified. |
| For example: |
| <pre> |
| <code> |
| var col:ICollectionView = new ArrayCollection(); |
| col.addItem("California"); |
| col.addItem("Arizona"); |
| var sort:Sort = new Sort(); |
| var sortfield:SortField = new SortField(null, true); |
| sortfield.setStyle("locale", "en-US"); |
| sort.fields = [sortfield]; |
| col.sort = sort; |
| </code> |
| </pre> |
| <p>The default comparison provided by the <code>SortField</code> class |
| provides correct language specific |
| sorting for strings. The language is selected by the setting the locale |
| style on an instance of the class in one of the following ways: |
| </p> |
| <ul> |
| <li> |
| By using the class in an MXML declaration and inheriting the |
| locale from the document that contains the declaration. |
| </li> |
| Example: |
| <pre> |
| <fx:Declarations> |
| <s:SortField id="sf" /> |
| </fx:Declarations> |
| </pre> |
| <li> |
| By using an MXML declaration and specifying the locale value |
| in the list of assignments. |
| </li> |
| Example: |
| <pre> |
| <fx:Declarations> |
| <s:SortField id="sf_SimplifiedChinese" locale="zh-Hans-CN" /> |
| </fx:Declarations> |
| </pre> |
| <li> |
| Calling the <code>setStyle</code> method, |
| e.g. <code>sf.setStyle("locale", "zh-Hans-CN")</code> |
| </li> |
| <li> |
| Inheriting the style from a <code>UIComponent</code> by calling the |
| UIComponent's <code>addStyleClient()</code> method. |
| </li> |
| </ul> |
| Note: to prevent problems like |
| <a href="#/issues.apache.org/jira/browse/FLEX-34853" target="">FLEX-34853</a> |
| it is recommended to use SortField |
| instances as immutable objects (by not changing their state). |
| |
| <p></p><a name="mxmlSyntaxSummary"></a><span class="classHeaderTableLabel">MXML Syntax</span><span id="showMxmlLink" style="display:none"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../images/collapsed.gif" title="collapsed" alt="collapsed" class="collapsedImage">Show MXML Syntax</a><br/></span><span id="hideMxmlLink"><a href="#mxmlSyntaxSummary" onclick="toggleMXMLOnly();"><img src="../../images/expanded.gif" title="expanded" alt="expanded" class="expandedImage">Hide MXML Syntax</a></span><div id="mxmlSyntax" class="mxmlSyntax"> <p>The <code><s:SortField></code> tag has the following attributes:</p> |
| <pre> |
| <s:SortField |
| <b>Properties</b> |
| compareFunction="<em>Internal compare function</em>" |
| descending="false" |
| name="null" |
| numeric="null" |
| /> |
| </pre> |
| </div><script language="javascript" type="text/javascript"><!-- |
| setMXMLOnly(); |
| --></script><p><a href="#includeExamplesSummary">View the examples</a></p><p><span class="classHeaderTableLabel">See also</span></p><div class="seeAlso"><a href="../../mx/collections/ICollectionView.html" target="">mx.collections.ICollectionView</a><br/><a href="Sort.html" target="">spark.collections.Sort</a></div><br/><hr></div><a name="propertySummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Properties</div><div class="showHideLinks"><div id="hideInheritedProperty" class="hideInheritedProperty"><a class="showHideLink" href="#propertySummary" onclick="javascript:setInheritedVisible(false,'Property');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Public Properties</a></div><div id="showInheritedProperty" class="showInheritedProperty"><a class="showHideLink" href="#propertySummary" onclick="javascript:setInheritedVisible(true,'Property');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Public Properties</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProperty"><tr><th> </th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#arraySortOnOptions" class="signatureLink">arraySortOnOptions</a> : int<div class="summaryTableDescription">[read-only] |
| |
| This helper property is used internally by the findItem() |
| and sort() methods.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#caseInsensitive" class="signatureLink">caseInsensitive</a> : Boolean<div class="summaryTableDescription">[read-only] |
| Specifies whether the sort for this field should be case insensitive.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#className" class="signatureLink">className</a> : String<div class="summaryTableDescription">[read-only] </div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#compareFunction" class="signatureLink">compareFunction</a> : Function<div class="summaryTableDescription">[override] |
| The function that compares two items during a sort of items for the |
| associated collection.</div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#descending" class="signatureLink">descending</a> : Boolean<div class="summaryTableDescription"> |
| |
| Specifies whether this field should be sorted in descending |
| order.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#id" class="signatureLink">id</a> : String<div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#inheritingStyles" class="signatureLink">inheritingStyles</a> : Object<div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#moduleFactory" class="signatureLink">moduleFactory</a> : <a href="../../mx/core/IFlexModuleFactory.html">IFlexModuleFactory</a><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#name" class="signatureLink">name</a> : String<div class="summaryTableDescription"> |
| |
| The name of the field to be sorted.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#nonInheritingStyles" class="signatureLink">nonInheritingStyles</a> : Object<div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#numeric" class="signatureLink">numeric</a> : Object<div class="summaryTableDescription"> |
| |
| Specifies that if the field being sorted contains numeric |
| (number/int/uint) values, or string representations of numeric values, |
| the comparator use a numeric comparison.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#sortCompareType" class="signatureLink">sortCompareType</a> : String<div class="summaryTableDescription"> |
| |
| Specifies what compare type will be used for the sortField.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#styleDeclaration" class="signatureLink">styleDeclaration</a> : <a href="../../mx/styles/CSSStyleDeclaration.html">CSSStyleDeclaration</a><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#styleManager" class="signatureLink">styleManager</a> : <a href="../../mx/styles/IStyleManager2.html">IStyleManager2</a><div class="summaryTableDescription">[read-only] </div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#styleName" class="signatureLink">styleName</a> : Object<div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#styleParent" class="signatureLink">styleParent</a> : <a href="../../mx/styles/IAdvancedStyleClient.html">IAdvancedStyleClient</a><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedProperty"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><a href="../../mx/collections/SortField.html#usingCustomCompareFunction" class="signatureLink">usingCustomCompareFunction</a> : Boolean<div class="summaryTableDescription">[read-only] |
| |
| True if this ISortField uses a custom comparator function.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr></table></div><a name="methodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Methods </div><div class="showHideLinks"><div id="hideInheritedMethod" class="hideInheritedMethod"><a class="showHideLink" href="#methodSummary" onclick="javascript:setInheritedVisible(false,'Method');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Hide Inherited Public Methods</a></div><div id="showInheritedMethod" class="showInheritedMethod"><a class="showHideLink" href="#methodSummary" onclick="javascript:setInheritedVisible(true,'Method');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Public Methods</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableMethod"><tr><th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#SortField()" class="signatureLink">SortField</a>(name:String = null, descending:Boolean = false, numeric:Object = null, sortCompareType:String = null, customCompareFunction:Function = null)</div><div class="summaryTableDescription"> |
| Constructor.</div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#clearStyle()" class="signatureLink">clearStyle</a>(styleProp:String):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#getClassStyleDeclarations()" class="signatureLink">getClassStyleDeclarations</a>():Array</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#getStyle()" class="signatureLink">getStyle</a>(styleProp:String):*</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#hasCSSState()" class="signatureLink">hasCSSState</a>():Boolean</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#initialized()" class="signatureLink">initialized</a>(document:Object, id:String):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/collections/SortField.html#initializeDefaultCompareFunction()" class="signatureLink">initializeDefaultCompareFunction</a>(obj:Object):void</div><div class="summaryTableDescription"> |
| |
| A helper function called by the Sort class to set the |
| default comparison function to perform a comparison based on |
| one of three things: whether or not a custom compare function has |
| been set, the data type for the specified field or the the value of the |
| numeric property.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#matchesCSSState()" class="signatureLink">matchesCSSState</a>(cssState:String):Boolean</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#matchesCSSType()" class="signatureLink">matchesCSSType</a>(cssType:String):Boolean</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#notifyStyleChangeInChildren()" class="signatureLink">notifyStyleChangeInChildren</a>(styleProp:String, recursive:Boolean):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/collections/SortField.html#objectHasSortField()" class="signatureLink">objectHasSortField</a>(object:Object):Boolean</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#regenerateStyleCache()" class="signatureLink">regenerateStyleCache</a>(recursive:Boolean):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#registerEffects()" class="signatureLink">registerEffects</a>(effects:Array):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/collections/SortField.html#reverse()" class="signatureLink">reverse</a>():void</div><div class="summaryTableDescription"> |
| |
| Reverse the criteria for this sort field.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#setStyle()" class="signatureLink">setStyle</a>(styleProp:String, newValue:*):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#styleChanged()" class="signatureLink">styleChanged</a>(styleProp:String):void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#stylesInitialized()" class="signatureLink">stylesInitialized</a>():void</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class="hideInheritedMethod"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/collections/SortField.html#updateSortCompareType()" class="signatureLink">updateSortCompareType</a>():Boolean</div><div class="summaryTableDescription"> |
| |
| This changes the internal compare function used by the SortField based |
| on the value of sortCompareType.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr></table></div><a name="protectedMethodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Methods </div><div class="showHideLinks"><div id="hideInheritedProtectedMethod" class="hideInheritedProtectedMethod"><a class="showHideLink" href="#protectedMethodSummary" onclick="javascript:setInheritedVisible(false,'ProtectedMethod');"><img class="showHideLinkImage" src="../../images/expanded.gif"> Show Inherited Protected Methods</a></div><div id="showInheritedProtectedMethod" class="showInheritedProtectedMethod"><a class="showHideLink" href="#protectedMethodSummary" onclick="javascript:setInheritedVisible(true,'ProtectedMethod');"><img class="showHideLinkImage" src="../../images/collapsed.gif"> Show Inherited Protected Methods</a></div></div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableProtectedMethod"><tr><th> </th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class="hideInheritedProtectedMethod"><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"><img src="../../images/inheritedSummary.gif" alt="Inherited" title="Inherited" class="inheritedSummaryImage"></td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="../../mx/collections/SortField.html#getSortFieldValue()" class="signatureLink">getSortFieldValue</a>(obj:Object):*</div><div class="summaryTableDescription"></div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/SortField.html">SortField</a></td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#stringCompare()" class="signatureLink">stringCompare</a>(a:Object, b:Object):int</div><div class="summaryTableDescription">[override] |
| Pull the strings from the objects and call the implementation.</div></td><td class="summaryTableOwnerCol">SortField</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#xmlCompare()" class="signatureLink">xmlCompare</a>(a:Object, b:Object):int</div><div class="summaryTableDescription">[override] |
| Pull the values out fo the XML object, then compare |
| using the string or numeric comparator depending |
| on the numeric flag.</div></td><td class="summaryTableOwnerCol">SortField</td></tr></table></div><a name="styleSummary"></a><div class="summarySection"><div class="summaryTableTitle">Styles</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableStyle"><tr><th> </th><th colspan="2">Style</th><th> Description </th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol"><a name="style:locale"></a> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><span class="signatureLink">locale</span></div></td><td class="summaryTableDescription"><span class="label">Type: </span>String <span class="label">CSS Inheritance: </span>yes<br/> |
| The locale identifier that specifies the language, region, script |
| and optionally other related tags and keys. |
| The syntax of this identifier must follow the syntax defined |
| by the Unicode Technical Standard #35 (for example, en-US, de-DE, zh-Hans-CN). |
| |
| <p>For browser based apps, the default locale is based on the language settings from the browser. |
| (Note that this is not the browser UI language that is available from Javascript, but rather is the list of |
| preferred locales for web pages that the user has set in the browser preferences.) For AIR applications, |
| the default UI locale is based on the user's system preferences.</p> |
| |
| <p><span class="label">See also</span></p><div class="seeAlso"><a href="http://www.unicode.org/reports/tr35/" target="mm_external">http://www.unicode.org/reports/tr35/</a></div></td><td class="summaryTableOwnerCol">SortField</td></tr></table></div><script language="javascript" type="text/javascript"><!-- |
| showHideInherited(); |
| --></script><div class="MainContent"><div class="detailSectionHeader">Property Detail</div><a name="propertyDetail"></a><a name="className"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">className</td><td class="detailHeaderType">property</td></tr></table><div class="detailBody"><code>className:String</code> [read-only] <p></p><br/><span class="label"> Implementation </span><br/><code> public function get className():String</code><br/></div><a name="propertyDetail"></a><a name="compareFunction"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">compareFunction</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>compareFunction:Function</code>[override] <p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>Flex 4.5</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>Flash Player 10.1, AIR 2.5</td></tr></table><p></p><p></p><p> |
| The function that compares two items during a sort of items for the |
| associated collection. If you specify a <code>compareFunction</code> |
| property in an <code>ISort</code> object, Flex ignores any |
| <code>compareFunction</code> properties of the ISort's |
| <code>SortField</code> objects. |
| |
| <p>The compare function must have the following signature:</p> |
| <p><code>function myCompare(a:Object, b:Object):int</code></p> |
| <p>This function must return the following values:</p> |
| <ul> |
| <li>-1, if the <code>Object a</code> should appear before the |
| <code>Object b</code> in the sorted sequence</li> |
| <li>0, if the <code>Object a</code> equals the |
| <code>Object b</code></li> |
| <li>1, if the <code>Object a</code> should appear after the |
| <code>Object b</code> in the sorted sequence</li> |
| </ul> |
| <p>The default value is an internal compare function that can perform |
| a string, numeric, or date comparison in ascending or descending order. |
| The string comparison is performed using the locale (language, |
| region and script) specific comparison method from the |
| <code>SortingCollator</code> class. |
| This class uses the locale style to determine a locale. |
| Specify your own function only if you need a need a custom comparison |
| algorithm. This is normally only the case if a calculated field is |
| used in a display.</p> |
| </p><br/><span class="label"> Implementation </span><br/><code> public function get compareFunction():Function</code><br/><code> public function set compareFunction(value:Function):void</code><br/></div><a name="propertyDetail"></a><a name="id"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">id</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>id:String</code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get id():String</code><br/><code> public function set id(value:String):void</code><br/></div><a name="propertyDetail"></a><a name="inheritingStyles"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">inheritingStyles</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>inheritingStyles:Object</code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get inheritingStyles():Object</code><br/><code> public function set inheritingStyles(value:Object):void</code><br/></div><a name="propertyDetail"></a><a name="moduleFactory"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">moduleFactory</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>moduleFactory:<a href="../../mx/core/IFlexModuleFactory.html">IFlexModuleFactory</a></code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get moduleFactory():<a href="../../mx/core/IFlexModuleFactory.html">IFlexModuleFactory</a></code><br/><code> public function set moduleFactory(value:<a href="../../mx/core/IFlexModuleFactory.html">IFlexModuleFactory</a>):void</code><br/></div><a name="propertyDetail"></a><a name="nonInheritingStyles"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">nonInheritingStyles</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>nonInheritingStyles:Object</code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get nonInheritingStyles():Object</code><br/><code> public function set nonInheritingStyles(value:Object):void</code><br/></div><a name="propertyDetail"></a><a name="styleDeclaration"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">styleDeclaration</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>styleDeclaration:<a href="../../mx/styles/CSSStyleDeclaration.html">CSSStyleDeclaration</a></code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get styleDeclaration():<a href="../../mx/styles/CSSStyleDeclaration.html">CSSStyleDeclaration</a></code><br/><code> public function set styleDeclaration(value:<a href="../../mx/styles/CSSStyleDeclaration.html">CSSStyleDeclaration</a>):void</code><br/></div><a name="propertyDetail"></a><a name="styleManager"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">styleManager</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>styleManager:<a href="../../mx/styles/IStyleManager2.html">IStyleManager2</a></code> [read-only] <p></p><br/><span class="label"> Implementation </span><br/><code> public function get styleManager():<a href="../../mx/styles/IStyleManager2.html">IStyleManager2</a></code><br/></div><a name="propertyDetail"></a><a name="styleName"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">styleName</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>styleName:Object</code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get styleName():Object</code><br/><code> public function set styleName(value:Object):void</code><br/></div><a name="propertyDetail"></a><a name="styleParent"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">styleParent</td><td class="detailHeaderType">property</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>styleParent:<a href="../../mx/styles/IAdvancedStyleClient.html">IAdvancedStyleClient</a></code><p></p><br/><span class="label"> Implementation </span><br/><code> public function get styleParent():<a href="../../mx/styles/IAdvancedStyleClient.html">IAdvancedStyleClient</a></code><br/><code> public function set styleParent(value:<a href="../../mx/styles/IAdvancedStyleClient.html">IAdvancedStyleClient</a>):void</code><br/></div><a name="constructorDetail"></a><div class="detailSectionHeader">Constructor Detail</div><a name="SortField()"></a><a name="SortField(String,Boolean,Object,String,Function)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">SortField</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">Constructor</td></tr></table><div class="detailBody"><code>public function SortField(name:String = null, descending:Boolean = false, numeric:Object = null, sortCompareType:String = null, customCompareFunction:Function = null)</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>Flex 4.5</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>Flash Player 10.1, AIR 2.5</td></tr></table><p></p><p> |
| Constructor. |
| </p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">name</span>:String</code> (default = <code>null</code>)<code></code> — The name of the property that this field uses for |
| comparison. |
| If the object is a simple type, pass <code>null</code>. |
| </td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">descending</span>:Boolean</code> (default = <code>false</code>)<code></code> — Tells the comparator whether to arrange items in |
| descending order. |
| </td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">numeric</span>:Object</code> (default = <code>null</code>)<code></code> — Tells the comparator whether to compare sort items as |
| numbers, instead of alphabetically. |
| </td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">sortCompareType</span>:String</code> (default = <code>null</code>)<code></code> — Gives an indication to SortField which of the |
| default compare functions to use. |
| </td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">customCompareFunction</span>:Function</code> (default = <code>null</code>)<code></code> — Use a custom function to compare the |
| objects based on this SortField. |
| </td></tr></table></div><a name="methodDetail"></a><div class="detailSectionHeader">Method Detail</div><a name="clearStyle()"></a><a name="clearStyle(String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">clearStyle</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td></tr></table><div class="detailBody"><code> public function clearStyle(styleProp:String):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">styleProp</span>:String</code></td></tr></table></p></div><a name="getClassStyleDeclarations()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">getClassStyleDeclarations</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function getClassStyleDeclarations():Array</code><p></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Array</code></td></tr></table></div><a name="getStyle()"></a><a name="getStyle(String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">getStyle</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function getStyle(styleProp:String):*</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">styleProp</span>:String</code></td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>*</code></td></tr></table></div><a name="hasCSSState()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">hasCSSState</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function hasCSSState():Boolean</code><p></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Boolean</code></td></tr></table></div><a name="initialized()"></a><a name="initialized(Object,String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">initialized</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function initialized(document:Object, id:String):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">document</span>:Object</code></td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">id</span>:String</code></td></tr></table></p></div><a name="matchesCSSState()"></a><a name="matchesCSSState(String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">matchesCSSState</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function matchesCSSState(cssState:String):Boolean</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">cssState</span>:String</code></td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Boolean</code></td></tr></table></div><a name="matchesCSSType()"></a><a name="matchesCSSType(String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">matchesCSSType</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function matchesCSSType(cssType:String):Boolean</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">cssType</span>:String</code></td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>Boolean</code></td></tr></table></div><a name="notifyStyleChangeInChildren()"></a><a name="notifyStyleChangeInChildren(String,Boolean)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">notifyStyleChangeInChildren</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">styleProp</span>:String</code></td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">recursive</span>:Boolean</code></td></tr></table></p></div><a name="regenerateStyleCache()"></a><a name="regenerateStyleCache(Boolean)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">regenerateStyleCache</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function regenerateStyleCache(recursive:Boolean):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">recursive</span>:Boolean</code></td></tr></table></p></div><a name="registerEffects()"></a><a name="registerEffects(Array)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">registerEffects</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function registerEffects(effects:Array):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">effects</span>:Array</code></td></tr></table></p></div><a name="setStyle()"></a><a name="setStyle(String,any)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">setStyle</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function setStyle(styleProp:String, newValue:*):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">styleProp</span>:String</code></td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">newValue</span>:*</code></td></tr></table></p></div><a name="stringCompare()"></a><a name="stringCompare(Object,Object)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">stringCompare</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>override protected function stringCompare(a:Object, b:Object):int</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>Flex 4.5</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>Flash Player 10.1, AIR 2.5</td></tr></table><p></p><p></p><p> |
| Pull the strings from the objects and call the implementation. |
| </p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">a</span>:Object</code></td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">b</span>:Object</code></td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>int</code></td></tr></table></div><a name="styleChanged()"></a><a name="styleChanged(String)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">styleChanged</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function styleChanged(styleProp:String):void</code><p></p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">styleProp</span>:String</code></td></tr></table></p></div><a name="stylesInitialized()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">stylesInitialized</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code> public function stylesInitialized():void</code><p></p></div><a name="xmlCompare()"></a><a name="xmlCompare(Object,Object)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">xmlCompare</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>override protected function xmlCompare(a:Object, b:Object):int</code><p></p><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Language Version : </b></td><td>ActionScript 3.0</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Product Version : </b></td><td>Flex 4.5</td></tr></table><table cellpadding="0" cellspacing="0" border="0"><tr><td style="white-space:nowrap" valign="top"><b> Runtime Versions : </b></td><td>Flash Player 10.1, AIR 2.5</td></tr></table><p></p><p></p><p> |
| Pull the values out fo the XML object, then compare |
| using the string or numeric comparator depending |
| on the numeric flag. |
| </p><p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">a</span>:Object</code></td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">b</span>:Object</code></td></tr></table></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code>int</code></td></tr></table></div><a name="includeExamplesSummary"></a><div class="detailSectionHeader">Examples</div><div class="exampleHeader">SortExample1.mxml</div><div class="detailBody"><div class="listing"><pre><?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| minWidth="955" minHeight="600"> |
| <!-- Sample program for spark.collections.Sort and SortField --> |
| <fx:Declarations> |
| <s:Sort id="sortbyLastName_FirstName"> |
| <s:fields> |
| <s:SortField name="last"/> |
| <s:SortField name="first"/> |
| </s:fields> |
| </s:Sort> |
| <mx:ArrayCollection id="collection" sort="{sortbyLastName_FirstName}"> |
| <mx:source> |
| <fx:Object first="Anders" last="Dickerson"/> |
| <fx:Object first="Eileen" last="Maccormick"/> |
| <fx:Object first="Aiden" last="MacCormick"/> |
| <fx:Object first="Steve" last="MacGregor"/> |
| </mx:source> |
| </mx:ArrayCollection> |
| </fx:Declarations> |
| |
| <s:VGroup> |
| <s:VGroup> |
| <s:HGroup> |
| <s:Label text="Input Locale ID Name: "/> |
| <s:TextInput id="inputLocaleIDName"/> |
| <!-- |
| Sets the locale style on the document UI component. |
| The SortField and Sort objects defined in the |
| fx:Declarations section will inherit this style. |
| --> |
| <s:Button click="{setStyle('locale', inputLocaleIDName.text); |
| collection.refresh()}" label="Apply"/> |
| </s:HGroup> |
| <s:Label text="Example: 'en-US', 'fr-FR', 'zh-CN', 'ar-SA'"/> |
| </s:VGroup> |
| <s:DataGrid dataProvider="{collection}" width="100%" |
| creationComplete="{collection.refresh()}"> |
| <s:columns> |
| <s:ArrayList> |
| <s:GridColumn dataField="last"/> |
| <s:GridColumn dataField="first"/> |
| </s:ArrayList> |
| </s:columns> |
| </s:DataGrid> |
| </s:VGroup> |
| </s:Application> |
| </pre></div><script language="javascript" type="text/javascript"><!-- AC_FL_RunContent( "src", "examples/SortExample1", "width", "100%", |
| "height","400px", "salign", "TL", "id", "example1", "quality", "high", "bgcolor", "", "name", |
| "example1", "flashvars","", "allowScriptAccess","sameDomain", "type", |
| "application/x-shockwave-flash","pluginspage", "http://www.macromedia.com/go/getflashplayer" ); --></script></div><div class="exampleHeader">SortExample2.mxml</div><div class="detailBody"><div class="listing"><pre><?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" |
| xmlns:s="library://ns.adobe.com/flex/spark" |
| xmlns:mx="library://ns.adobe.com/flex/mx" |
| minWidth="955" minHeight="600" |
| creationComplete="initApp()"> |
| <!-- Sample program for spark.collections.Sort and SortField --> |
| <fx:Script> |
| <![CDATA[ |
| import mx.collections.ArrayCollection; |
| import spark.collections.*; |
| [Bindable] |
| private var collection:ArrayCollection = new ArrayCollection(); |
| |
| private function localeChange():void |
| { |
| // Sets the locale style on this application. |
| // The SortField objects will inherit this style. |
| setStyle('locale', inputLocaleIDName.text); |
| collection.refresh(); |
| } |
| |
| private function initApp() : void |
| { |
| // Add data to the collection. |
| collection.addItem({first:"Anders", last:"Dickerson"}); |
| collection.addItem({first:"Steve", last:"Maccormick"}); |
| collection.addItem({first:"Aiden", last:"MacCormick"}); |
| collection.addItem({first:"Eileen", last:"MacGregor"}); |
| |
| // Create the Sort instance. |
| var sort:Sort = new Sort(); |
| |
| // Set the sort field; sort on the last name first, first name |
| // second. |
| var sortfieldLastName:SortField = new SortField("last",true); |
| var sortfieldFirstName:SortField = new SortField("first",true); |
| sort.fields = [sortfieldLastName, sortfieldFirstName]; |
| |
| // Add the sort field objects to this application's list of |
| // style clients. This will cause the sort field objects to |
| // inherit the locale style from this Application. |
| addStyleClient(sortfieldLastName); |
| addStyleClient(sortfieldFirstName); |
| |
| // Assign the Sort object to the view. |
| collection.sort = sort; |
| |
| // Apply the sort to the collection. |
| collection.refresh(); |
| } |
| ]]> |
| </fx:Script> |
| |
| <s:VGroup> |
| <s:VGroup> |
| <s:HGroup> |
| <s:Label text="Input Locale ID Name: "/> |
| <s:TextInput id="inputLocaleIDName"/> |
| <s:Button click="localeChange()" label="Apply"/> |
| </s:HGroup> |
| <s:Label text="Example: 'en-US', 'fr-FR', 'zh-CN', 'ar-SA'"/> |
| </s:VGroup> |
| |
| <s:DataGrid dataProvider="{collection}" width="100%" |
| creationComplete="{collection.refresh()}"> |
| <s:columns> |
| <s:ArrayList> |
| <s:GridColumn dataField="last"/> |
| <s:GridColumn dataField="first"/> |
| </s:ArrayList> |
| </s:columns> |
| </s:DataGrid> |
| </s:VGroup> |
| </s:Application> |
| </pre></div><script language="javascript" type="text/javascript"><!-- AC_FL_RunContent( "src", "examples/SortExample2", "width", "100%", |
| "height","400px", "salign", "TL", "id", "example2", "quality", "high", "bgcolor", "", "name", |
| "example2", "flashvars","", "allowScriptAccess","sameDomain", "type", |
| "application/x-shockwave-flash","pluginspage", "http://www.macromedia.com/go/getflashplayer" ); --></script></div><br/><br/><hr><br/><p></p><center class="copyright"><footer>The Apache Software Foundation</footer><br/>Wed Nov 15 2017, 09:50 AM +01:00 </center></div></body></html><!--The Apache Software Foundation<br/>Wed Nov 15 2017, 09:50 AM +01:00 --> |