Dear DHTMLX experts,
I have dhtmlxTree pro and have a tree with just one parent node and many child nodes. DragAndDropBehavior is “sibling”, and I can drop items from other trees just fine.
However, this tree has to be sorted alphabetically, so I need an “autosort” functionality so that no matter where an item is dropped, it will be moved to the correct position automatically. I tried using the “sortTree” method, but this always gives me a javascript error “Object does not support this property or method”.
This is my code:
#tree_var#.attachEvent("onDrop",function(){#tree_var#.sortTree(0,'ASC',1);});
The same error happens when I use the example code from the "Smart XML parsing and Sorting
" example in the documentation:
#tree_var#.attachEvent("onDrop",function(id, target, target_before, tree_source, tree_dest){tree_dest.sortTree(target,'ASC',1);});
What am I doing wrong? Is there another way to achieve the desired autosort functionality?
Regards, Richard