Constructor
new SortingHelpers()
Methods
(static) performIntegerSort(source, target, siblings, sortKey, sortBefore) → {Array.<object>}
Given a source object to sort, a target to sort relative to, and an Array of siblings in the container: Determine the updated sort keys for the source object, or all siblings if a reindex is required. Return an Array of updates to perform, it is up to the caller to dispatch these updates. Each update is structured as: { target: object, update: {sortKey: sortValue} }
Parameters:
Name | Type | Description |
---|---|---|
source |
* | The source object being sorted |
target |
* | The target object relative which to sort |
siblings |
Array.<object> | The sorted Array of siblings which share the same sorted container |
sortKey |
string | The name of the data property within the source object which defines the sort key |
sortBefore |
boolean | Whether to sort before the target (if true) or after (if false) |
Returns:
An Array of updates for the caller of the helper function to perform
- Type
- Array.<object>