auto expand a node in the tree (browser) if there's no other node. patch from Tomasz...
authorxzilla <xzilla>
Tue, 4 Sep 2007 15:25:18 +0000 (15:25 +0000)
committerxzilla <xzilla>
Tue, 4 Sep 2007 15:25:18 +0000 (15:25 +0000)
CREDITS
HISTORY
xloadtree/xloadtree2.js

diff --git a/CREDITS b/CREDITS
index 85c7ddb27b915b9c506148a8b4be827b75f7cdb6..7f6e774c9d0e83ba3ecfe12f314a715bff771d28 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -61,6 +61,8 @@ Contributors
 - Eric Kinolik
 - John Jawed
 - JGuillaume 'ioguix' De Rorthais
+- Karl O. Pinc  
+- Tomasz Pala
 
 Third Party Libraries
 
diff --git a/HISTORY b/HISTORY
index 08f166209a47b0993587bf6087164414f9f809b7..55bab5e618b6e6c1939e17839e0f0fd98ba71ee2 100644 (file)
--- a/HISTORY
+++ b/HISTORY
@@ -12,6 +12,7 @@ Features
 * Pagination selection available for reports
 * You can configure reports db, schema and table names
 * Add support for creating a table using an exsting one (ioguix)
+* Auto-expand a node in the tree browser if there are no other nodes (Tomasz Pala)
 
 Bugs
 * Fix inability to assign a field type/domain of a different schema
index 87dbc6d181b3036d9c5009b7473dc18cf9ffe3b1..b36eed7ebda69825e99916d7fe0654649721419c 100644 (file)
@@ -405,13 +405,19 @@ WebFXLoadTree.documentLoaded = function (jsNode) {
                var count = 0;\r
                var cs = root.childNodes;\r
                var l = cs.length;\r
+               var newNode;\r
                for (var i = 0; i < l; i++) {\r
                        if (cs[i].tagName == "tree") {\r
-                               jsNode.add(WebFXLoadTree.createItemFromElement(cs[i]));\r
+                               newNode=WebFXLoadTree.createItemFromElement(cs[i]);\r
+                               jsNode.add(newNode);\r
                                count++;\r
                        }\r
                }\r
 \r
+               if (count == 1 && newNode.childNodes.length) {\r
+                       var parent=jsNode.parentNode;\r
+                       newNode.setExpanded(true);\r
+               }\r
                // if no children we got an error\r
                if (count == 0) {\r
                        jsNode.errorText = webFXTreeConfig.errorLoadingText + " " + jsNode.src + " (???)";\r