diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 21ab51ea..719b2946 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -513,7 +513,7 @@ class LeftAndMain extends Controller { // Wrap the root if needs be. if(!$rootID) { - $rootLink = '#'; + $rootLink = $this->Link('show') . '/root'; // This lets us override the tree title with an extension if($this->hasMethod('getCMSTreeTitle')) $treeTitle = $this->getCMSTreeTitle(); @@ -820,12 +820,16 @@ JS; $form->setFields($readonlyFields); } } else { - $form = $this->EmptyForm(); + $form = $this->RootForm(); } return $form; } + function RootForm() { + return $this->EmptyForm(); + } + /** * Returns a placeholder form, used by {@link getEditForm()} if no record is selected. * Our javascript logic always requires a form to be present in the CMS interface. diff --git a/javascript/LeftAndMain.Tree.js b/javascript/LeftAndMain.Tree.js index 215fe418..d4c1e318 100755 --- a/javascript/LeftAndMain.Tree.js +++ b/javascript/LeftAndMain.Tree.js @@ -26,7 +26,7 @@ var _HANDLER_FORMS = { onmatch: function() { // make sure current ID of loaded form is actually selected in tree var id = $('#Form_EditForm :input[name=ID]').val(); - if(id) this[0].setCurrentByIdx(id); + this[0].setCurrentByIdx(id); } }; });