Interface: SortDescriptor

SortDescriptor

Describes the information necessary to sort a table based upon a column.

Members

columnIndex :number

Optional property indicating the index of the column this SortDescriptor describes how to sort. If this property is not a positive number, it will be assumed this SortDescriptor describes how to sort entire rows.

Type:
  • number
Source:

Methods

compare(itemA, itemB) → {number}

Callback comparator function that compares one cell or row to another. If SortDescriptor#columnIndex is defined, and a postiive number, HTMLTableCellElements in the approprite position within the rows being compared will be passed to this function corresponding to this SortDescriptor's SortDescriptor#columnIndex property, otherwise the HTMLTableRowElements undergoing comparison will be passed.

If this function returns a value greater than 0, the relevant row corresponding to the first given item will be sorted below the second, if a value less than 0, the first will be sorted above the second, and if 0, no preference will be applied.

Parameters:
Name Type Description
itemA HTMLCellElement | HTMLTableRowElement

Reference cell or row.

itemB HTMLCellElement | HTMLTableRowElement

Compare cell or row.

Source:
Returns:

A value greater than 0 if itemA should be sorted below itemB, less than 0 for above, 0 for no preference.

Type
number