Automatically expand child nodes as well as the selected node on the treeview if there is only one. Fixes #3559

This also ensure the browser state is cleared if the save interval is set to -1.
This commit is contained in:
Khushboo Vashi
2019-02-14 09:18:08 +00:00
committed by Dave Page
parent 438116c574
commit 17694ab467
6 changed files with 65 additions and 1 deletions

View File

@@ -999,8 +999,17 @@ define('pgadmin.browser.node', [
});
},
opened: function(item) {
let tree = pgBrowser.tree,
auto_expand = pgBrowser.get_preference('browser', 'auto_expand_sole_children');
pgBrowser.Events.trigger('pgadmin:browser:tree:update-tree-state',
item);
if (auto_expand && auto_expand.value == true && tree.children(item).length == 1) {
// Automatically expand the child node, if a treeview node has only a single child.
tree.open(tree.first(item));
}
},
closed: function(item) {
pgBrowser.Events.trigger('pgadmin:browser:tree:remove-from-tree-state',