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
This commit is contained in:
Ingo Schommer 2010-02-23 03:46:51 +00:00 committed by Sam Minnee
parent cc8c1e3031
commit 7ffbefb6b1

View File

@ -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