onSort([callback], [remove])

Class: Table.

Description:

Gets, registers or unregisters an event handler function for column sorting event. This event handler is called when a column is sorted by user or programmatically.

Parameters:

Name Type Default Description

[callback]

function

The event handler function. Receives an event object.

[remove]

boolean

false

Set to true to unregister the event handler.

Returns:

An array of handler functions if no arguments are passed, otherwise this component for method chaining.

Type: Table | Array.<function()>

Examples:

// Example event object:
const e = {
  target: Table,         // The Table component that triggered the event.
  type: Table.SortOrder, // Table.SortOrder.None, Table.SortOrder.Ascending, or Table.SortOrder.Descending.
  column: number         // Only when type is not Table.SortOrder.None. Column index.
  newOrderColumn: number // Only when type is not Table.SortOrder.None. New column index, taking into account that columns may be re-ordered.
  interactive: boolean   // `true` when sorting was made by the user interacting with the GUI. `false` when it was made programmatically.
};