DataSet.useSort()

Availability

Flash Player 7.

Edition

Flash MX Professional 2004.

Usage

dataSetInstance.useSort(sortName, order)

Parameters

sortName A string that contains the name of the sort to use.

order An integer value that indicates the sort order for the sort; the value must be DataSetIterator.Ascending or DataSetIterator.Descending.

Returns

Nothing.

Description

Method; switches the sort for the current iterator to the one specified by sortName, if it exists. If the specified sort does not exist, a DataSetError exception is thrown.

To create a sort, use DataSet.addSort().

Example

The following example uses DataSet.hasSort() to determine if a sort named "customer" exists. If it does, the code calls DataSet.useSort() to make "customer" the current sort. Otherwise, the code creates a sort by that name using DataSet.addSort().

if (my_ds.hasSort("customer")) {
    my_ds.useSort("customer");
} else {
    my_ds.addSort("customer", ["customer"], DataSetIterator.Descending);
}

See also

DataSet.applyUpdates(), DataSet.hasSort()


Flash CS3