Permalink
Browse files

MINOR Fixed node deselection when changing areas (e.g. "pages" to "ed…

…it page")
  • Loading branch information...
1 parent 9e21fb8 commit 69d349749784c3b0a652e6580c19dac962cee4b1 @chillu chillu committed Jun 4, 2012
Showing with 10 additions and 8 deletions.
  1. +10 −8 admin/javascript/LeftAndMain.Tree.js
@@ -247,20 +247,22 @@
newNode.find('a:first').html(title).attr('href', ss.i18n.sprintf(
self.data('urlEditpage'), id
));
- self.jstree('deselect_node', parentNode);
+ self.jstree('deselect_all');
self.jstree('select_node', newNode);
}
);
- // set current tree element
- this.jstree('select_node', node);
}
- // set correct parent (only if it has changed)
- if(parentID && parentID != node.parents('li:first').data('id')) {
- this.jstree('move_node', node, parentNode.length ? parentNode : -1, 'last');
- }
+ if(node.length) {
+ // set correct parent (only if it has changed)
+ if(parentID && parentID != node.parents('li:first').data('id')) {
+ this.jstree('move_node', node, parentNode.length ? parentNode : -1, 'last');
+ }
- this.jstree('select_node', node);
+ // Only single selection is supported on initial load
+ this.jstree('deselect_all');
+ this.jstree('select_node', node);
+ }
} else {
// If no ID exists in a form view, we're displaying the tree on its own,
// hence to page should show as active

0 comments on commit 69d3497

Please sign in to comment.