From 7ffbefb6b15aa57e750984d9821b3df725ad333a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 23 Feb 2010 03:46:51 +0000 Subject: [PATCH] BUGFIX Changed sitetree default selection in LeftAndMain.Tree.js to fire on window.load instead of document.ready() through entwine. We need to ensure behaviour.js bindings are available before BUGFIX Automatically selecting root node in CMS trees (necessary because now we actually have forms on the root node, and its a valid click target) (from r99605) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@99693 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/LeftAndMain_left.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/javascript/LeftAndMain_left.js b/javascript/LeftAndMain_left.js index 90302581..8d07c056 100755 --- a/javascript/LeftAndMain_left.js +++ b/javascript/LeftAndMain_left.js @@ -16,6 +16,17 @@ var _HANDLER_FORMS = { search : 'search_options' }; +(function($) { + $(window).bind('load', function(e) { + // behaviour.js load handlers need to be fired before this event, so we artificially delay it + setTimeout(function() { + // make sure current ID of loaded form is actually selected in tree + var tree = $('#sitetree')[0], id = $('#Form_EditForm :input[name=ID]').val(); + if(!id) id = 0; + tree.setCurrentByIdx(id); + }, 200); + }); +}(jQuery)); /** * Overload this with a real context menu if necessary