Interface SortingOptions<Data>

Type interface for sorting options.

Type Parameters

Hierarchy

Custom Component Properties

Component?: SortingComponent<Data>

Custom component to manage all sorting buttons. It overrides all sorting indicators.

ascendingIndicator?: ReactNode

Indicator when column is sorted in ascending order. Used in default sorting component.

Default

'↓'

defaultIndicator?: ReactNode

Indicator when column is not sorted. Used in default sorting component.

Default

'⇅'

descendingIndicator?: ReactNode

Indicator when column is sorted in descending order. Used in default sorting component.

Default

'↑'

Other Properties

autoResetSortBy?: boolean

Reset sorting when data is changed.

Default

true

defaultCanSort?: boolean

Enable sorting for all columns, regardless if they have a valid accessor.

Default

false

disableMultiSort?: boolean

Disables multi-sorting for the entire table.

Default

false

disableSortBy?: boolean

Disable sorting for table.

Default

false

disableSortRemove?: boolean

If true, the un-sorted state will not be available to columns once they have been sorted.

Default

false

disabledMultiRemove?: boolean

If true, the un-sorted state will not be available to multi-sorted columns.

Default

false

initialState?: UseSortByState<Data>

Initial settings of sorting. List of objects containing column id and order preference.

Example

{ sortBy: [{ id: 'columnsId', desc: false }] }
isMultiSortEvent?: ((e: MouseEvent<Element, MouseEvent>) => boolean)

Type declaration

    • (e: MouseEvent<Element, MouseEvent>): boolean
    • Allows to override default multi-sort detection behaviour. Receives mouse-event as param.

      Parameters

      • e: MouseEvent<Element, MouseEvent>

      Returns boolean

manualSortBy?: boolean

Manual sorting with custom logic, eg. server-side.

Default

false

See

orderByFn

maxMultiSortColCount?: number

Limit on max number of columns for multi-sort.

Default

Infinite

onStateChange?: StateChangeHandler<UseSortByState<Data>>

Callback executed when columns are sorted. The function must be wrapped in useCallback hook.

orderByFn?: ((rows: Row<Data>[], sortFns: SortByFn<Data>[], directions: boolean[]) => Row<Data>[])

Type declaration

    • (rows: Row<Data>[], sortFns: SortByFn<Data>[], directions: boolean[]): Row<Data>[]
    • Composing multiple sorting functions together for multi-sorting

      Parameters

      • rows: Row<Data>[]
      • sortFns: SortByFn<Data>[]
      • directions: boolean[]

      Returns Row<Data>[]

sortTypes?: Record<string, SortByFn<Data>>

Allows overriding or adding additional sort types for columns to use. If a column's sort type isn't found on this object, it will default to using the built-in sort types. Must be memoised.

Generated using TypeDoc