The sort
enables jstree to automatically sort all nodes using a specified function. This means that when the user creates, renames or moves nodes around - they will automatically sort.
Expects a function. The functions receives two arguments - two nodes to be compared. Return -1
or 1
. Default is:
function (a, b) { return this.get_text(a) > this.get_text(b) ? 1 : -1; }
1 | $( function () { |
2 | $( "#rename" ).click( function () { |
3 | $( "#demo1" ).jstree( "rename" ); |
4 | }); |
5 | $( "#demo1" ).jstree({ |
6 | "plugins" : [ "themes" , "html_data" , "ui" , "crrm" , "sort" ] |
7 | }); |
8 | }); |
Sorts the children of the specified node - this function is called automatically.
mixed
node
This can be a DOM node, jQuery node or selector pointing to the element.