Sorting Technical Reference
Custom Sort State
CustomSortState
Custom Sort section of Adaptable State, including Initial State.
Each entry replaces the normal sort of one column with the order in SortedValues. Values in that list sort in list order. Values absent from the list sort after them, using the normal comparison. A custom sort comparer registered for the column is used instead of SortedValues.
Custom Sorts to apply. One column uses the first Custom Sort whose ColumnId matches.
Custom Sort
CustomSort
A column sorted in a fixed order instead of the normal comparison.
ColumnId is the column. SortedValues is the order: listed values come first, in that order, and any other value sorts after them. Date values are stored as ISO dates (yyyy-MM-dd). Suspend with IsSuspended.
string
Id of Column on which Custom Sort will be applied
string
Name of the Custom Sort definition
(string | number)[]
Sort order. Listed values come first, in this order. Any other value sorts after them. Dates are stored as ISO strings (yyyy-MM-dd).
boolean
Sets Entity to ReadOnly (overwriting a Strategy Entitlement of 'Full')
boolean
Suspends (i.e. turns off) an Adaptable Object
Custom Sort Options
CustomSortOptions
Used to provide Custom Sorts comparers
ColumnValuesComparer<TData>[]
CustomSort column comparer functions
customSortComparers entries are a ColumnValuesComparer:
ColumnValuesComparer
Comparer object for Column Values - used for custom sorting
Custom Sort API
CustomSortApi
Custom sort orders for columns: the values to show first, and which sorts are active.
Adds a Custom Sort to Custom Sort collection in Adaptable State
Creates new Custom Sort based on given values
void
Removes Custom Sort for a given ColumnId
Edits a Custom Sort
Updates existing Custom Sort with new set of Sorted Values
Retrieves all Custom Sorts that are active (not-suspended) in Adaptable State
Retrieves Custom Sort by the technical ID (from CustomSortState)
CustomSort | undefined
Retrieves a Custom Sort by its Name
CustomSort | undefined
Retrieves Custom Sort from Adaptable State for Column with given ColumnId
Retrieves all Custom Sorts in Adaptable State
Retrieves Custom Sort section from Adaptable State
Returns all Custom Sort Comparers in Custom Sort Options that are currently applied
Retrieves all Custom Sorts in Adaptable State that are currently applied
Retrieves all Custom Sorts that are suspended in Adaptable State
void
Opens Settings Panel with Custom Sort section selected and visible
void
Suspends all Custom Sorts
Suspends Custom Sort
void
Activates all suspended Custom Sort
Un-suspends or activates a suspended Custom Sort
Grid Sorted Event
AdapTable fires the Grid Sorted Event whenever any column in AdapTable is sorted.
It provides information on what is being sorted in AdapTable.
Find Out More
This is often used when wanting to manage expressions on the Server
GridSortedInfo
The GridSortedInfo object provided by the event returns a single object:
GridSortedInfo
Payload of the GridSorted event.
Fires when the grid sort changes, including a Custom Sort. The payload is the sort state after the change.
Extends , so adaptableApi is included.
Column sorts and Custom Sorts after this change.
Custom application Context provided in AdaptableOptions.adaptableContext
The AdaptableSortState object provides information on what is being sorted in AdapTable.
AdaptableSortState
Overview of current, live, sorting state in grid
Columns currently being sorted (with direction)
Custom Sort Comparers which are currently applied
Custom Sorts which are currently applied
Each columnSorts entry is a ColumnSort:
ColumnSort
One column in a layout sort.
On Layout.ColumnSorts, the array order is the sort priority: the first entry is the primary sort. SortOrder is 'Asc' or 'Desc'.
It contains 2 sections:
- Column Sorts active in AG Grid
- Custom Sorts which have been provided in Initial State (i.e. not supplied via Comparers)
Caution
Custom Sorts are always sent even if none are currently active
Event Subscription
Subscribing to the Event is done the same way as with all Adaptable Events:
api.eventApi.on('GridSorted', (eventInfo: GridSortedInfo) => {
// do something with the info
});Find Out More
There are also some sorting-related functions in Grid API