+ }],
+ data: [{
+ name: 'Person1',
+ rank: 'second'
+ }, {
+ name: 'Person2',
+ rank: 'third'
+ }, {
+ name: 'Person3',
+ rank: 'first'
+ }]
+ });
+
+ * @markdown
+ */
+Ext.define('Ext.util.Sorter', {
+
+<span id='Ext-util-Sorter-cfg-property'> /**
+</span> * @cfg {String} property The property to sort by. Required unless {@link #sorterFn} is provided.
+ * The property is extracted from the object directly and compared for sorting using the built in
+ * comparison operators.
+ */
+
+<span id='Ext-util-Sorter-cfg-sorterFn'> /**
+</span> * @cfg {Function} sorterFn A specific sorter function to execute. Can be passed instead of {@link #property}.
+ * This sorter function allows for any kind of custom/complex comparisons.
+ * The sorterFn receives two arguments, the objects being compared. The function should return:
+ * <ul>
+ * <li>-1 if o1 is "less than" o2</li>
+ * <li>0 if o1 is "equal" to o2</li>
+ * <li>1 if o1 is "greater than" o2</li>
+ * </ul>
+ */
+
+<span id='Ext-util-Sorter-cfg-root'> /**
+</span> * @cfg {String} root Optional root property. This is mostly useful when sorting a Store, in which case we set the
+ * root to 'data' to make the filter pull the {@link #property} out of the data object of each item
+ */
+
+<span id='Ext-util-Sorter-cfg-transform'> /**
+</span> * @cfg {Function} transform A function that will be run on each value before
+ * it is compared in the sorter. The function will receive a single argument,
+ * the value.
+ */
+
+<span id='Ext-util-Sorter-cfg-direction'> /**
+</span> * @cfg {String} direction The direction to sort by. Defaults to ASC
+ */
+ direction: "ASC",
+
+ constructor: function(config) {
+ var me = this;
+
+ Ext.apply(me, config);
+
+ //<debug>
+ if (me.property === undefined && me.sorterFn === undefined) {
+ Ext.Error.raise("A Sorter requires either a property or a sorter function");