Sorting
hasActiveSorting
Section titled “hasActiveSorting”Checks whether a sorting map contains at least one active order.
Empty maps and properties with undefined order are treated as inactive.
export declare function hasActiveSorting(sorting?: SortingOrder): boolean;;getSortingIndex
Section titled “getSortingIndex”Returns one-based additive sorting rank for a column.
A single active sort does not need a visible rank, so it returns undefined.
export declare function getSortingIndex(sorting: SortingOrder | undefined, prop: ColumnProp, sortingOrder?: SortingColumnOrder): SortingColumnRender['sortIndex'];;sortIndexByItems
Section titled “sortIndexByItems”Sorts row indexes against a source collection.
@param indexes - Current proxy row indexes to sort.
@param source - Full source collection addressed by the indexes.
@param sortingFunc - Comparator functions by column property.
@param sorting - Active sorting order by column property.
@param sortingColumns - Column metadata by property for default-comparer optimization.
@param sortingOrder - Active sorting priority in click/config insertion order.
@returns Sorted proxy indexes. With no sorting function keys, returns source-order indexes.
export declare function sortIndexByItems(indexes: number[], source: DataType[], sortingFunc?: SortingOrderFunction, sorting?: SortingOrder, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder): number[];;defaultCellCompare
Section titled “defaultCellCompare”export declare function defaultCellCompare(this: { column?: ColumnRegular;}, prop: ColumnProp, a: DataType, b: DataType): 0 | 1 | -1;;descCellCompare
Section titled “descCellCompare”export declare function descCellCompare(cmp: CellCompareFunc): (prop: ColumnProp, a: DataType, b: DataType) => number;;getNextOrder
Section titled “getNextOrder”export declare function getNextOrder(currentOrder: Order): Order;;getComparer
Section titled “getComparer”export declare function getComparer(column: Partial<ColumnRegular> | undefined, order: Order): CellCompareFunc | undefined;;SortingPlugin
Section titled “SortingPlugin”Lifecycle 1.
@event beforesorting - Triggered when sorting just starts. Nothing has happened yet. This can be triggered from a column or from the source. If the type is from rows, the column will be undefined.
2.
@event beforesourcesortingapply - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted.
3.
@event beforesortingapply - Triggered before the sorting data is applied to the data source. You can prevent this event, and the data will not be sorted. This event is only called from a column sorting click.
4.
@event aftersortingapply - Triggered after sorting has been applied and completed. The event detail includes the final sorting state and sorting column metadata when available.
Note: If you prevent an event, it will not proceed to the subsequent steps.
class SortingPlugin { /** * Schedules sorting before the next render. * * @param order - Active sorting order by column property. * @param sortingFunc - Comparator functions by column property. * @param sortingColumns - Column metadata by property. * @param sortingOrder - Active sorting priority in click/config insertion order. * @param ignoreViewportUpdate - Skips dimension position recalculation when true. */ startSorting(order?: SortingOrder, sortingFunc?: SortingOrderFunction, ignoreViewportUpdate?: boolean): void;;
startSorting(order?: SortingOrder, sortingFunc?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, ignoreViewportUpdate?: boolean): void;;
/** * Applies sorting requested by a sortable header click. * * @param column - Column that initiated sorting. * @param additive - If true, add/remove this column from the current multi-sort state. */ headerclick(column: ColumnRegular, additive: boolean): void;;
/** * Runs a scheduled sort and resolves the render-blocking sorting promise. * * @param order - Active sorting order by column property. * @param comparison - Comparator functions by column property. * @param sortingColumns - Column metadata by property. * @param sortingOrder - Active sorting priority in click/config insertion order. * @param ignoreViewportUpdate - Skips dimension position recalculation when true. */ runSorting(order?: SortingOrder, comparison?: SortingOrderFunction, ignoreViewportUpdate?: boolean): void;;
runSorting(order?: SortingOrder, comparison?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, ignoreViewportUpdate?: boolean): void;;
/** * Sorts row proxy indexes by sorting functions. * * @requires proxyItems applied to row store * @requires source applied to row store * * @param sorting - per column sorting * @param sortingFunc - Comparator functions by column property. * @param sortingColumns - Column metadata by property. * @param sortingOrder - Active sorting priority in click/config insertion order. * @param types - Row stores to sort. * @param ignoreViewportUpdate - Skips dimension position recalculation when true. */ sort(sorting?: SortingOrder, sortingFunc?: SortingOrderFunction, types?: DimensionRows[], ignoreViewportUpdate?: boolean): void;;
sort(sorting?: SortingOrder, sortingFunc?: SortingOrderFunction, sortingColumns?: SortingColumnMap, sortingOrder?: SortingColumnOrder, types?: DimensionRows[], ignoreViewportUpdate?: boolean): void;;}SortingOrder
Section titled “SortingOrder”Current sorting order per column property.
/** * Current sorting order per column property. */export type SortingOrder = Record<ColumnProp, Order>;SortingOrderFunction
Section titled “SortingOrderFunction”Comparator functions indexed by column property.
Undefined comparator entries are treated as inactive sorting entries.
/** * Comparator functions indexed by column property. * * Undefined comparator entries are treated as inactive sorting entries. */export type SortingOrderFunction = Record<ColumnProp, CellCompareFunc | undefined>;SortingColumnMap
Section titled “SortingColumnMap”Column metadata indexed by column property.
This is an internal companion map for SortingOrderFunction. It lets the
sorting helper detect the default comparer path without mutating
CellCompareFunc instances or changing the public comparator contract.
/** * Column metadata indexed by column property. * * This is an internal companion map for `SortingOrderFunction`. It lets the * sorting helper detect the default comparer path without mutating * `CellCompareFunc` instances or changing the public comparator contract. */export type SortingColumnMap = Record<ColumnProp, Partial<ColumnRegular> | undefined>;SortingColumnOrder
Section titled “SortingColumnOrder”Active sorting priority in click/config insertion order.
This is stored separately from SortingOrder because JavaScript object keys
that look like integers are enumerated in numeric order, not insertion order.
/** * Active sorting priority in click/config insertion order. * * This is stored separately from `SortingOrder` because JavaScript object keys * that look like integers are enumerated in numeric order, not insertion order. */export type SortingColumnOrder = ColumnProp[];SortingColumnRender
Section titled “SortingColumnRender”Header metadata used to display additive sort priority.
/** * Header metadata used to display additive sort priority. */export type SortingColumnRender = { /** * One-based additive sorting rank. */ sortIndex?: number;};AfterSortingApplyEvent
Section titled “AfterSortingApplyEvent”Sorting information emitted after sorting is applied.
/** * Sorting information emitted after sorting is applied. */export type AfterSortingApplyEvent = { /** * Final active sorting order per column property. */ sorting?: SortingOrder; /** * Column metadata indexed by sorted column property. */ sortingColumns?: SortingColumnMap; /** * Active sorting priority in click/config insertion order. */ sortingOrder?: SortingColumnOrder; /** * Row stores affected by the sorting run. */ types: DimensionRows[];};ColumnSetEvent
Section titled “ColumnSetEvent”Sorting information emitted after columns are set.
/** * Sorting information emitted after columns are set. */export type ColumnSetEvent = { order: SortingOrder;};SortingConfig
Section titled “SortingConfig”External sorting configuration.
/** * External sorting configuration. */export type SortingConfig = { /** * Columns to sort by. */ columns?: { prop: ColumnProp; order: Order; cellCompare?: CellCompareFunc; }[]; /** * If true, merge provided columns with the current sorting state. * If false or omitted, replace current sorting state. */ additive?: boolean;};SortingSign
Section titled “SortingSign”Renders sorting direction and optional additive sorting rank.
SortingSign: ({ column }: Props) => any;