For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

## Sencha Documentation

# Ext.data.SortTypes

This class defines a series of static methods that are used on a Ext.data.Field for performing sorting. The methods cast the underlying values into a data type that is appropriate for sorting on that particular field. If a Ext.data.Field.type is specified, the sortType will be set to a sane default if the sortType is not explicitly defined on the field. The sortType will make any necessary modifications to the value and return it.

- asText - Removes any tags and converts the value to a string
- asUCText - Removes any tags and converts the value to an uppercase string
- asUCText - Converts the value to an uppercase string
- asDate - Converts the value into Unix epoch time
- asFloat - Converts the value to a floating point number
- asInt - Converts the value to an integer number

It is also possible to create a custom sortType that can be used throughout an application.

    Ext.apply(Ext.data.SortTypes, {
        asPerson: function(person){
            // expects an object with a first and last name property
            return person.lastName.toUpperCase() + person.firstName.toLowerCase();
        }
    });

    Ext.define('Employee', {
        extend: 'Ext.data.Model',
        fields: [{
            name: 'person',
            sortType: 'asPerson'
        }, {
            name: 'salary',
            type: 'float' // sortType set to asFloat
        }]
    });

Defined By

### Properties

Ext.data.SortTypes
view source
stripTagsRE : RegExp

The regular expression used to strip tags

The regular expression used to strip tags

Defined By

### Methods

Ext.data.SortTypes
view source
asDate( Mixed s) : Number

Date sorting

Date sorting

### Parameters

- s : Mixed

  The value being converted

### Returns

- Number

  The comparison value

Ext.data.SortTypes
view source
asFloat( Mixed s) : Float

Float sorting

Float sorting

### Parameters

- s : Mixed

  The value being converted

### Returns

- Float

  The comparison value

Ext.data.SortTypes
view source
asInt( Mixed s) : Number

Integer sorting

Integer sorting

### Parameters

- s : Mixed

  The value being converted

### Returns

- Number

  The comparison value

Ext.data.SortTypes
view source
asText( Mixed s) : String

Strips all HTML tags to sort on text only

Strips all HTML tags to sort on text only

### Parameters

- s : Mixed

  The value being converted

### Returns

- String

  The comparison value

Ext.data.SortTypes
view source
asUCString( Mixed s) : String

Case insensitive string

Case insensitive string

### Parameters

- s : Mixed

  The value being converted

### Returns

- String

  The comparison value

Ext.data.SortTypes
view source
asUCText( Mixed s) : String

Strips all HTML tags to sort on text only - Case insensitive

Strips all HTML tags to sort on text only - Case insensitive

### Parameters

- s : Mixed

  The value being converted

### Returns

- String

  The comparison value

Ext.data.SortTypes
view source
none( Mixed s) : Mixed

Default sort that does nothing

Default sort that does nothing

### Parameters

- s : Mixed

  The value being converted

### Returns

- Mixed

  The comparison value