diff --git a/deluge/ui/web/js/deluge-add.js b/deluge/ui/web/js/deluge-add.js index 2773c2f8a..2179a239e 100644 --- a/deluge/ui/web/js/deluge-add.js +++ b/deluge/ui/web/js/deluge-add.js @@ -51,7 +51,9 @@ Deluge.Add = { }, onRender: function(window) { - + new Ext.tree.TreeSorter(this.Files, { + folderSort: true + }); }, onSelect: function(selModel, rowIndex, record) { @@ -68,6 +70,7 @@ Deluge.Add = { } else { parent.appendChild(new Ext.tree.TreeNode({ filename: file, + text: file, // this needs to be here for sorting reasons size: fsize(item[0]), leaf: true, checked: item[1], @@ -79,7 +82,10 @@ Deluge.Add = { } this.clearFiles(); - walk(torrentInfo['files'], this.Files.getRootNode()); + + var root = this.Files.getRootNode(); + walk(torrentInfo['files'], root); + root.firstChild.expand(); }, onTorrentAdded: function(info) { diff --git a/deluge/ui/web/js/deluge-details.js b/deluge/ui/web/js/deluge-details.js index 1aa6f7d21..e02f08d24 100644 --- a/deluge/ui/web/js/deluge-details.js +++ b/deluge/ui/web/js/deluge-details.js @@ -201,6 +201,10 @@ Deluge.Details.Files = { this.panel = panel; this.panel.clear = this.clear.bind(this); this.panel.update = this.update.bind(this); + + new Ext.tree.TreeSorter(this.panel, { + folderSort: true + }); }, onRequestComplete: function(files, torrentId) { @@ -225,6 +229,7 @@ Deluge.Details.Files = { child = new Ext.tree.TreeNode({ id: file, filename: file, + text: file, // this needs to be here for sorting size: fsize(item[0]), progress: item[1], leaf: true, @@ -238,6 +243,7 @@ Deluge.Details.Files = { } var root = this.panel.getRootNode(); walk(files, root); + root.firstChild.expand(); }, clear: function() {