blob: e37005811471bdf509b3e179f0292f67ff5eddab [file] [log] [blame]
{ "type": "class",
"qname": "org.apache.royale.collections.Sort",
"baseClassname": "org.apache.royale.events.EventDispatcher"
,
"description": "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>\\n var col:ICollectionView = new ArrayCollection();\\n // In the real world, the collection would have more than one item.\\n col.addItem({first:&quot;Anders&quot;, last:&quot;Dickerson&quot;});\\n \\n // Create the Sort instance.\\n var sort:ISort = new Sort();\\n \\n // Set the sort field; sort on the last name first, first name second.\\n // Both fields are case-insensitive.\\n sort.fields = [new SortField(&quot;last&quot;,true), new SortField(&quot;first&quot;,true)];\\n // Assign the Sort object to the view.\\n col.sort = sort;\\n \\n // Apply the sort to the collection.\\n col.refresh();\\n </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>\\n var col:ICollectionView = new ArrayCollection();\\n col.addItem(&quot;California&quot;);\\n col.addItem(&quot;Arizona&quot;);\\n var sort:Sort = new Sort();\\n \\n // There is only one sort field, so use a <code>null</code>\\n // first parameter.\\n sort.fields = [new SortField(null, true)];\\n col.sort = sort;\\n col.refresh();\\n </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>By default this Sort class does not provide correct language specific sorting for strings. For this type of sorting please see the <code>spark.collections.Sort</code> and <code>spark.collections.SortField</code> classes.</p> Note: to prevent problems like <a href=&quot;https://issues.apache.org/jira/browse/FLEX-34853&quot;>FLEX-34853</a> it is recommended to use SortField instances as immutable objects (by not changing their state). <p>The <code>&lt;mx:Sort&gt;</code> tag has the following attributes:</p> <pre>\\n &lt;mx:Sort\\n <b>Properties</b>\\n compareFunction=&quot;<em>Internal compare function</em>&quot;\\n fields=&quot;null&quot;\\n unique=&quot;false | true&quot;\\n /&gt;\\n </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> <p>Just like any other <code>AdvancedStyleClient</code>-based classes, the <code>Sort</code> and <code>SortField</code> classes do not have a parent-child relationship in terms of event handling. Locale changes in a <code>Sort</code> instance are not dispatched to its <code>SortField</code> instances automatically. The only exceptional case is the internal default <code>SortField</code> instance used when no explicit fields are provided. In this case, the internal default <code>SortField</code> instance follows the locale style that the owner <code>Sort</code> instance has.</p>",
"tags": [
{ "tagName": "see",
"values": ["org.apache.royale.collections.IArrayListView", "org.apache.royale.collections.ISortField", "org.apache.royale.collections.Sort", "org.apache.royale.collections.SortField"]},
{ "tagName": "mxml",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"members": [
{ "type": "field",
"qname": "ANY_INDEX_MODE",
"return": "String",
"namespace": "public",
"bindable": [],
"details": ["static"],
"deprecated": {},
"description": "When executing a find return the index any matching item.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "field",
"qname": "FIRST_INDEX_MODE",
"return": "String",
"namespace": "public",
"bindable": [],
"details": ["static"],
"deprecated": {},
"description": "When executing a find return the index for the first matching item.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "field",
"qname": "LAST_INDEX_MODE",
"return": "String",
"namespace": "public",
"bindable": [],
"details": ["static"],
"deprecated": {},
"description": "When executing a find return the index for the last matching item.",
"tags": [
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "method",
"qname": "org.apache.royale.collections.Sort",
"namespace": "",
"bindable": [],
"details": [],
"deprecated": {},
"description": "Constructor. <p>Creates a new Sort with no fields set and no custom comparator.</p> specifies the fields to compare. objects in the collection to which this sort will be applied.",
"tags": [
{ "tagName": "param",
"values": ["fields An <code>Array</code> of <code>ISortField</code> objects that", "customCompareFunction Use a custom function to compare the", "unique Indicates if the sort should be unique."]},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "",
"params": [{ "name": "fields", "type": "Array"},
{ "name": "customCompareFunction", "type": "Function"},
{ "name": "unique", "type": "Boolean"}]}
,
{ "type": "accessor",
"access": "read-write",
"return": "Boolean",
"qname": "useSortOn",
"namespace": "internal",
"bindable": [],
"details": [],
"deprecated": {}},
{ "type": "accessor",
"access": "read-write",
"return": "Function",
"qname": "compareFunction",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "accessor",
"access": "read-write",
"return": "Array",
"qname": "fields",
"namespace": "public",
"bindable": ["fieldsChanged"],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "default",
"values": ["null"]},
{ "tagName": "see",
"values": ["org.apache.royale.collections.SortField"]},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "accessor",
"access": "read-write",
"return": "Boolean",
"qname": "unique",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "default",
"values": ["false"]},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ]},
{ "type": "method",
"qname": "findItem",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "int",
"params": [{ "name": "items", "type": "Array"},
{ "name": "values", "type": "Object"},
{ "name": "mode", "type": "String"},
{ "name": "returnInsertionIndex", "type": "Boolean"},
{ "name": "compareFunction", "type": "Function"}]}
,
{ "type": "method",
"qname": "propertyAffectsSort",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "Boolean",
"params": [{ "name": "property", "type": "String"}]}
,
{ "type": "method",
"qname": "reverse",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "void",
"params": []}
,
{ "type": "method",
"qname": "sort",
"namespace": "public",
"bindable": [],
"details": [],
"deprecated": {},
"description": "",
"tags": [
{ "tagName": "inheritDoc",
"values": []},
{ "tagName": "playerversion",
"values": ["Flash 10.2", "AIR 2.6"]},
{ "tagName": "productversion",
"values": ["Royale 0.0"]},
{ "tagName": "langversion",
"values": ["3.0"]} ],
"return": "void",
"params": [{ "name": "items", "type": "Array"}]}
,
{ "type": "method",
"qname": "createEmptySortField",
"namespace": "protected",
"bindable": [],
"details": [],
"deprecated": {},
"return": "org.apache.royale.collections.ISortField",
"params": []}
]
}