From 1aeed05fa7cf099fc952aa012526eea1963e1988 Mon Sep 17 00:00:00 2001 From: xzilla Date: Tue, 4 Sep 2007 15:25:18 +0000 Subject: [PATCH] auto expand a node in the tree (browser) if there's no other node. patch from Tomasz Pala --- CREDITS | 2 ++ HISTORY | 1 + xloadtree/xloadtree2.js | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index 85c7ddb2..7f6e774c 100644 --- 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 08f16620..55bab5e6 100644 --- 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 diff --git a/xloadtree/xloadtree2.js b/xloadtree/xloadtree2.js index 87dbc6d1..b36eed7e 100644 --- a/xloadtree/xloadtree2.js +++ b/xloadtree/xloadtree2.js @@ -405,13 +405,19 @@ WebFXLoadTree.documentLoaded = function (jsNode) { var count = 0; var cs = root.childNodes; var l = cs.length; + var newNode; for (var i = 0; i < l; i++) { if (cs[i].tagName == "tree") { - jsNode.add(WebFXLoadTree.createItemFromElement(cs[i])); + newNode=WebFXLoadTree.createItemFromElement(cs[i]); + jsNode.add(newNode); count++; } } + if (count == 1 && newNode.childNodes.length) { + var parent=jsNode.parentNode; + newNode.setExpanded(true); + } // if no children we got an error if (count == 0) { jsNode.errorText = webFXTreeConfig.errorLoadingText + " " + jsNode.src + " (???)"; -- 2.39.5