| <!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="Sort,spark.collections.Sort,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.Sort</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 = 'Sort - 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/Sort.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">Sort</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="#constantSummary">Constants</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("Sort"); titleBar_setSubNav(true,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 Sort</td></tr><tr><td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">Sort <img src="../../images/inherit-arrow.gif" title="Inheritance" alt="Inheritance" class="inheritArrow"> <a href="../../mx/collections/Sort.html">Sort</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></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 an |
| existing view (<code>ICollectionView</code> interface or class that |
| implements the interface). After you assign a <code>Sort</code> instance to the view's |
| <code>sort</code> property, you must call the view's |
| <code>refresh()</code> method to apply the sort criteria. |
| <p>Typically the sort is defined for collections of complex items, that is |
| collections in which the sort is performed on one or more properties of |
| the objects in the collection. |
| The following example shows this use:</p> |
| <pre> |
| <code> |
| var col:ICollectionView = new ArrayCollection(); |
| // In the real world, the collection would have more than one item. |
| col.addItem({first:"Anders", last:"Dickerson"}); |
| |
| // Create the Sort instance. |
| var sort:ISort = new Sort(); |
| |
| // Set the sort field; sort on the last name first, first name second. |
| var sortfieldLastName:ISortField = new SortField("last",true); |
| var sortfieldFirstName:ISortField = new SortField("first",true); |
| |
| // Set the locale style to "en-US" to cause the strings |
| // to be ordered according to the rules for English as used in the USA. |
| sortfieldLastName.setStyle("locale","en-US"); |
| sortfieldFirstName.setStyle("locale","en-US"); |
| sort.fields = [sortfieldLastName, sortfieldFirstName]; |
| |
| // Assign the Sort object to the view. |
| col.sort = sort; |
| |
| // Apply the sort to the collection. |
| col.refresh(); |
| </code> |
| </pre> |
| <p>There are situations in which the collection contains simple items, |
| like <code>String</code>, <code>Date</code>, <code>Boolean</code>, etc. |
| In this case, apply the sort to the simple type directly. |
| When constructing a sort for simple items, use a single sort field, |
| and specify a <code>null</code> |
| <code>name</code> (first) parameter |
| in the SortField object constructor. |
| For example: |
| <pre> |
| <code> |
| import mx.collections.ArrayCollection; |
| import spark.collections.Sort; |
| import spark.collections.SortField; |
| |
| var col:ICollectionView = new ArrayCollection(); |
| col.addItem("California"); |
| col.addItem("Arizona"); |
| var sort:Sort = new Sort(); |
| |
| // There is only one sort field, so use a <code>null</code> |
| // first parameter. |
| var sortfield:SortField = new SortField("null",true); |
| |
| // Set the locale style to "en-US" to set the language for the sort. |
| sortfield.setStyle("locale","en-US"); |
| sort.fields = [sortfield]; |
| col.sort = sort; |
| col.refresh(); |
| </code> |
| </pre> |
| </p> |
| <p>The Flex implementations of the <code>ICollectionView</code> interface |
| retrieve all items from a remote location before executing a sort. |
| If you use paging with a sorted list, apply the sort to the remote |
| collection before you retrieve the data. |
| </p> |
| <p>The default comparison provided by the <code>SortField</code> class |
| provides correct language-specific |
| sorting for strings. The language is selected by 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:Sort></code> tag has the following attributes:</p> |
| <pre> |
| <s:Sort |
| <b>Properties</b> |
| compareFunction="<em>Internal compare function</em>" |
| fields="null" |
| unique="false | true" |
| /> |
| </pre> |
| <p>In case items have inconsistent data types or items have complex data types, the use of the default |
| built-in compare functions is not recommended. Inconsistent sorting results may occur in such cases. |
| To avoid such problem, provide a custom compare function and/or make the item types consistent.</p> |
| </div><script language="javascript" type="text/javascript"><!-- |
| setMXMLOnly(); |
| --></script><p><span class="classHeaderTableLabel">Default MXML Property</span><code>fields</code></p><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="SortField.html" target="">spark.collections.SortField</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=""><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">Sort</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/Sort.html#compareFunction" class="signatureLink">compareFunction</a> : Function<div class="summaryTableDescription"> |
| |
| The method used to compare items when sorting.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</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/Sort.html#fields" class="signatureLink">fields</a> : Array<div class="summaryTableDescription"> |
| |
| An Array of ISortField objects that |
| specifies the fields to compare.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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/Sort.html#unique" class="signatureLink">unique</a> : Boolean<div class="summaryTableDescription"> |
| |
| Indicates if the sort should be unique.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</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="#Sort()" class="signatureLink">Sort</a>(fields:Array = null, customCompareFunction:Function = null, unique:Boolean = false)</div><div class="summaryTableDescription"> |
| Constructor.</div></td><td class="summaryTableOwnerCol">Sort</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">Sort</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/Sort.html#findItem()" class="signatureLink">findItem</a>(items:Array, values:Object, mode:String, returnInsertionIndex:Boolean = false, compareFunction:Function = null):int</div><div class="summaryTableDescription"> |
| |
| Finds the specified object within the specified array (or the insertion |
| point if asked for), returning the index if found or -1 if not.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</a></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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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">Sort</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/Sort.html#propertyAffectsSort()" class="signatureLink">propertyAffectsSort</a>(property:String):Boolean</div><div class="summaryTableDescription"> |
| |
| Return whether the specified property is used to control the sort.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</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">Sort</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">Sort</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/Sort.html#reverse()" class="signatureLink">reverse</a>():void</div><div class="summaryTableDescription"> |
| |
| Goes through the fields array and calls |
| reverse() on each of the ISortField objects in |
| the array.</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</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">Sort</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/Sort.html#sort()" class="signatureLink">sort</a>(items:Array):void</div><div class="summaryTableDescription"> |
| |
| Apply the current sort to the specified array (not a copy).</div></td><td class="summaryTableOwnerCol"><a href="../../mx/collections/Sort.html">Sort</a></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">Sort</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">Sort</td></tr></table></div><a name="protectedMethodSummary"></a><div class="summarySection"><div class="summaryTableTitle">Protected Methods </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=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><div class="summarySignature"><a href="#createEmptySortField()" class="signatureLink">createEmptySortField</a>():<a href="../../mx/collections/ISortField.html">ISortField</a></div><div class="summaryTableDescription">[override] </div></td><td class="summaryTableOwnerCol">Sort</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">Sort</td></tr></table></div><a name="constantSummary"></a><div class="summarySection"><div class="summaryTableTitle">Public Constants</div><table cellspacing="0" cellpadding="3" class="summaryTable " id="summaryTableConstant"><tr><th> </th><th colspan="2">Constant</th><th class="summaryTableOwnerCol">Defined By</th></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#ANY_INDEX_MODE" class="signatureLink">ANY_INDEX_MODE</a> : String = any<div class="summaryTableDescription">[static] |
| When executing a find return the index any matching item.</div></td><td class="summaryTableOwnerCol">Sort</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#FIRST_INDEX_MODE" class="signatureLink">FIRST_INDEX_MODE</a> : String = first<div class="summaryTableDescription">[static] |
| When executing a find return the index for the first matching item.</div></td><td class="summaryTableOwnerCol">Sort</td></tr><tr class=""><td class="summaryTablePaddingCol"> </td><td class="summaryTableInheritanceCol"> </td><td class="summaryTableSignatureCol"><a href="#LAST_INDEX_MODE" class="signatureLink">LAST_INDEX_MODE</a> : String = last<div class="summaryTableDescription">[static] |
| When executing a find return the index for the last matching item.</div></td><td class="summaryTableOwnerCol">Sort</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="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="Sort()"></a><a name="Sort(Array,Function,Boolean)"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">Sort</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">Constructor</td></tr></table><div class="detailBody"><code>public function Sort(fields:Array = null, customCompareFunction:Function = null, unique:Boolean = false)</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>Creates a new Sort with no fields set and no custom comparator.</p> |
| </p><span class="label"> Parameters </span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20px"></td><td><code><span class="label">fields</span>:Array</code> (default = <code>null</code>)<code></code> — An <code>Array</code> of <code>ISortField</code> objects that |
| specifies the fields to compare. |
| </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 in the collection to which this sort will be applied. |
| </td></tr><tr><td class="paramSpacer"> </td></tr><tr><td width="20px"></td><td><code><span class="label">unique</span>:Boolean</code> (default = <code>false</code>)<code></code> — Indicates if the sort should be unique. |
| </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="createEmptySortField()"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">createEmptySortField</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>override protected function createEmptySortField():<a href="../../mx/collections/ISortField.html">ISortField</a></code><p></p><p></p><span class="label">Returns</span><table cellpadding="0" cellspacing="0" border="0"><tr><td width="20"></td><td><code><a href="../../mx/collections/ISortField.html">ISortField</a></code></td></tr></table></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="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><div class="detailSectionHeader">Constant Detail</div><a name="constantDetail"></a><a name="ANY_INDEX_MODE"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">ANY_INDEX_MODE</td><td class="detailHeaderType">Constant</td></tr></table><div class="detailBody"><code>public static const ANY_INDEX_MODE:String = any</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> |
| When executing a find return the index any matching item. |
| </p></div><a name="constantDetail"></a><a name="FIRST_INDEX_MODE"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">FIRST_INDEX_MODE</td><td class="detailHeaderType">Constant</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>public static const FIRST_INDEX_MODE:String = first</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> |
| When executing a find return the index for the first matching item. |
| </p></div><a name="constantDetail"></a><a name="LAST_INDEX_MODE"></a><table class="detailHeader" cellpadding="0" cellspacing="0"><tr><td class="detailHeaderName">LAST_INDEX_MODE</td><td class="detailHeaderType">Constant</td><td class="detailHeaderRule"> </td></tr></table><div class="detailBody"><code>public static const LAST_INDEX_MODE:String = last</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> |
| When executing a find return the index for the last matching item. |
| </p></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 --> |