Tree.Sortable Class
Extension for Tree
that makes nodes sortable.
Constructor
Tree.Sortable
-
[config]
Parameters:
-
[config]
Object optionalConfiguration options.
-
[sortComparator]
Function optionalDefault comparator function to use when sorting a node's children if the node itself doesn't have a custom comparator function. If not specified, insertion order will be used by default.
-
[sortReverse=false]
Boolean optionalIf
true
, node children will be sorted in reverse (descending) order by default. Otherwise they'll be sorted in ascending order.
-
Item Index
Properties
Events
Methods
_compare
-
a
-
b
Compares value a to value b for sorting purposes.
Values are assumed to be the result of calling a sortComparator function.
Parameters:
-
a
MixedFirst value to compare.
-
b
MixedSecond value to compare.
Returns:
_compareReverse
-
a
-
b
Compares value a to value b for sorting purposes, but sorts them in reverse (descending) order.
Values are assumed to be the result of calling a sortComparator function.
Parameters:
-
a
MixedFirst value to compare.
-
b
MixedSecond value to compare.
Returns:
_getDefaultNodeIndex
-
parent
-
node
-
[options]
Overrides Tree#_getDefaultNodeIndex()
to provide insertion-time sorting
for nodes inserted without an explicit index.
Parameters:
Returns:
children
array.
_sort
-
a
-
b
-
comparator
-
[reverse=false]
Array sort function used by sortNode()
to re-sort a node's children.
Parameters:
Returns:
sortComparator
-
node
Default comparator function to use when sorting a node's children if the node itself doesn't have a custom comparator function.
If not specified, insertion order will be used by default.
Parameters:
-
node
Tree.NodeNode being sorted.
sortNode
-
node
-
[options]
Sorts the children of the specified node.
Parameters:
-
node
Tree.NodeNode whose children should be sorted.
-
[options]
Object optionalOptions.
-
[silent]
Boolean optionalIf
true
, nosort
event will be fired. -
[sortComparator]
Function optionalCustom comparator function to use. If specified, this will become the node's new comparator function, overwriting any previous comparator function that was set for the node.
-
[sortReverse]
Boolean optionalIf
true
, children will be sorted in reverse (descending) order. Otherwise they'll be sorted in ascending order. This will become the node's new sort order, overwriting any previous sort order that was set for the node. -
[src]
String optionalSource of the sort operation. Will be passed along to the
sort
event facade.
-
Properties
sortReverse
Boolean
If true
, node children will be sorted in reverse (descending) order by
default. Otherwise they'll be sorted in ascending order.
Default: false