From febb1b80b1f5682db8a257c0b43d63179ec6e71d Mon Sep 17 00:00:00 2001 From: Surinder Kumar Date: Tue, 20 Sep 2016 11:18:07 +0100 Subject: [PATCH] Ensure items are properly added to the treeview when their parent has no pre-existing children. Fixes #1627 --- web/pgadmin/browser/templates/browser/js/browser.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js index 151d05b2c..46c49cfc9 100644 --- a/web/pgadmin/browser/templates/browser/js/browser.js +++ b/web/pgadmin/browser/templates/browser/js/browser.js @@ -820,6 +820,10 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) { ctx.b._findTreeChildNode( ctx.i, d, ctx ); + // if parent node is null + if (!_data._pid) { + addItemNode.apply(ctx, arguments); + } } return true; }.bind(ctx), @@ -958,9 +962,11 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) { }); }.bind(ctx); - if (!ctx.t.isInode(ctx.i) && ctx.d.inode) { + if (ctx.i && !ctx.t.isInode(ctx.i)) { ctx.t.setInode(ctx.i, {success: _append}); } else { + // Handle case for node without parent i.e. server-group + // or if parent node's inode is true. _append(); } }