X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/tree/reorder.js diff --git a/examples/tree/reorder.js b/examples/tree/reorder.js index ba81dd39..7d31150a 100644 --- a/examples/tree/reorder.js +++ b/examples/tree/reorder.js @@ -1,32 +1,54 @@ -/*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * 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', - - root: { - nodeType: 'async', - text: 'Ext JS', - draggable: false, - id: 'src' - } - }); - - // render the tree - tree.render('tree-div'); - tree.getRootNode().expand(); -}); \ No newline at end of file +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: { + text: 'Ext JS', + id: 'src', + expanded: true + }, + folderSort: true, + sorters: [{ + property: 'text', + direction: 'ASC' + }] + }); + + 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(); + } + }] + }] + }); +});