Skip to content

ReadOnlyObservableCollection.toSorted

Andrei Fangli edited this page Sep 3, 2023 · 1 revision

Returns a JavaScript Array containing the items of the collection in ascending order.

This is a public method.

public toSorted(compareFn?: (a: TItem, b: TItem) => number): TItem[]

Parameters

  • compareFn: Function, optional, a callback used to determine the sort order between two items.

    Parameters:

    • a: TItem, the first item for comparison.
    • b: TItem, the second item for comparison.

    Returns: Number

    Returns the comparison result. Less than 0 (zero) means a is less than b, greater than 0 (zero) means a is greater than b, and 0 (zero) means the two items are equal.

Returns: TResult[]

A new Array with the elements sorted in ascending order.

See

Clone this wiki locally