new SortedManager(compareFunc)
Parameters:
| Name | Type | Description |
|---|---|---|
compareFunc |
function |
- Implements:
Methods
-
activateDepth(depth)
-
Activate the ranking manager for the specified depth
Parameters:
Name Type Description depthnumber - Implements:
Throws:
-
If the manager has already been activated
- Type
- Error
-
handleItem(added, tag, index [, value])
-
Handles an item (registers or unregisters it) that must be ranked.
This method returns a Deferred ranking object. This object will be passed to the following transformers like Related and Filter (but not Sort transformer), to handle the addition of new items (in case of relation) or removal of the item (in case of filtering)
Parameters:
Name Type Argument Description addedboolean Whether the item is added or removed
tagstring Item's tag
indexstring Item's index
value* <optional>
A value associated to the item, that can be used to sort it.
- Implements:
Returns:
-
isActivated()
-
Checks wether or not this manager has been activated
- Implements:
Returns:
- Type
- boolean
-
setRanksUpdateHandler(callback)
-
Sets a function called whenever ranks are updated. The callback gets the ordered array of children indexes as argument.
Parameters:
Name Type Description callbackolympe.dc.ranking.Manager.RanksUpdateCallback - Implements:
-
updateActiveRanks()
-
Updates the ranks of all the items at the previously activated depth
- Implements:
Throws:
-
If the manager has not been activated yet
- Type
- Error
Olympe SDK