This script shows basic drag and drop node moving in a tree. In this implementation there are no restrictions and anything can be dropped anywhere except appending to nodes marked “leaf” (the files).
Drag along the edge of the tree to trigger auto scrolling while performing a drag and drop.
In order to demonstrate drag and drop insertion points, sorting was not enabled.
The data for this tree is asynchronously loaded with a JSON TreeLoader.
The js is not minified so it is readable.
Ext.onReady(function(){
// shorthand
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
useArrows: true,
autoScroll: true,
animate: true,
enableDD: true,
containerScroll: true,
border: false,
// auto create TreeLoader
dataUrl: 'get-nodes.php',
root: {
nodeType: 'async',
text: 'Ext JS',
draggable: false,
id: 'src'
}
});
// render the tree
tree.render('tree-div');
tree.getRootNode().expand();
});
Demo: http://extjs.com/deploy/dev/examples/tree/reorder.html
Download: http://extjs.com/deploy/dev/examples/tree/reorder.js
Source: http://extjs.com/deploy/dev/examples/tree/reorder.html

Related Listings:
No comments yet.
RSS feed for comments on this post. TrackBack URL