X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6a7e4474cba9d8be4b2ec445e10f1691f7277c50..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/tree/reorder.js diff --git a/examples/tree/reorder.js b/examples/tree/reorder.js index 6f0464fc..7d31150a 100644 --- a/examples/tree/reorder.js +++ b/examples/tree/reorder.js @@ -1,32 +1,54 @@ -/*! - * Ext JS Library 3.2.0 - * Copyright(c) 2006-2010 Ext JS, Inc. - * licensing@extjs.com - * http://www.extjs.com/license - */ -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', +Ext.require([ + 'Ext.tree.*', + 'Ext.data.*', + 'Ext.tip.*' +]); +Ext.onReady(function() { + Ext.QuickTips.init(); + + var store = Ext.create('Ext.data.TreeStore', { + proxy: { + type: 'ajax', + url: 'get-nodes.php' + }, root: { - nodeType: 'async', text: 'Ext JS', - draggable: false, - id: 'src' - } + id: 'src', + expanded: true + }, + folderSort: true, + sorters: [{ + property: 'text', + direction: 'ASC' + }] }); - // render the tree - tree.render('tree-div'); - tree.getRootNode().expand(); -}); \ No newline at end of file + var tree = Ext.create('Ext.tree.Panel', { + store: store, + viewConfig: { + plugins: { + ptype: 'treeviewdragdrop' + } + }, + renderTo: 'tree-div', + height: 300, + width: 250, + title: 'Files', + useArrows: true, + dockedItems: [{ + xtype: 'toolbar', + items: [{ + text: 'Expand All', + handler: function(){ + tree.expandAll(); + } + }, { + text: 'Collapse All', + handler: function(){ + tree.collapseAll(); + } + }] + }] + }); +});