Index: tree.js =================================================================== --- tree.js (revision 13805) +++ tree.js (working copy) @@ -25,6 +25,15 @@ return this.isFolder() && this.Container; } +TreeItem.prototype.isLoaded = function() +{ + if (!this.isFolder()) { + return false; + } + + return (this.LateLoadURL && this.Loaded) || !this.LateLoadURL; +} + TreeItem.prototype.Render = function(before, force) { if (!this.Rendered || force) { @@ -145,10 +154,18 @@ // in case of "true" is returned, used in catalog // in case of object (tree node) is returned, used in advanced view if (this.treeItem.isContainer()) { - this.href = this.treeItem.locateFirstItem().Url; + if (this.treeItem.isLoaded()) { + this.treeItem.ContainerClicked = false; + this.href = this.treeItem.locateFirstItem().Url; + getFrame(link.target).location.href = this.href; + } + else { + this.treeItem.ContainerClicked = true; + } } - - getFrame(link.target).location.href = this.href; + else { + getFrame(link.target).location.href = this.href; + } } if (!this.treeItem.Expanded && this.treeItem.isFolder()) { @@ -321,6 +338,7 @@ this.Priority = isset(priority) ? priority : false; this.debugOnly = isset(debug_only) ? debug_only : false; this.Container = isset(container) ? parseInt(container) : false; + this.ContainerClicked = false; this.Children = new Array(); this.ChildIndex = 0; @@ -548,10 +566,16 @@ $object.Render(); $object.locateTopItem().updateLastNodes(); $object.expand(); + if (last_highlighted_key) { var fld = $object.locateItemByKey(last_highlighted_key) if (fld) { - fld.highLight(); + if (fld.ParentFolder.ContainerClicked) { + $('a:first', fld.Tr).click(); + } + else { + fld.highLight(); + } } }