Author: damoxc

Revision: 4965

Log:
        add sorting of the files by filenames, and folders display at the top

Diff:
Modified: trunk/deluge/ui/web/js/deluge-add.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-add.js        2009-04-01 16:31:51 UTC (rev 
4964)
+++ trunk/deluge/ui/web/js/deluge-add.js        2009-04-01 16:33:31 UTC (rev 
4965)
@@ -51,7 +51,9 @@
        },
        
        onRender: function(window) {
-               
+               new Ext.tree.TreeSorter(this.Files, {
+                       folderSort: true
+               });
        },
        
        onSelect: function(selModel, rowIndex, record) {
@@ -68,6 +70,7 @@
                                } 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 @@
                }
                
                this.clearFiles();
-               walk(torrentInfo['files'], this.Files.getRootNode());
+               
+               var root = this.Files.getRootNode();
+               walk(torrentInfo['files'], root);
+               root.firstChild.expand();
        },
        
        onTorrentAdded: function(info) {

Modified: trunk/deluge/ui/web/js/deluge-details.js
===================================================================
--- trunk/deluge/ui/web/js/deluge-details.js    2009-04-01 16:31:51 UTC (rev 
4964)
+++ trunk/deluge/ui/web/js/deluge-details.js    2009-04-01 16:33:31 UTC (rev 
4965)
@@ -201,6 +201,10 @@
                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 @@
                                                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 @@
                }
                var root = this.panel.getRootNode();
                walk(files, root);
+               root.firstChild.expand();
        },
        
        clear: function() {



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to