From aee24175f44b14e89a04cc2a33cb8e78d9c73191 Mon Sep 17 00:00:00 2001 From: Brian Ford Date: Tue, 9 Dec 2014 15:52:26 -0800 Subject: [PATCH] fix(json-tree): handle inspecting array elements --- panel/components/json-tree/json-tree.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/panel/components/json-tree/json-tree.js b/panel/components/json-tree/json-tree.js index 994d965..86e3d47 100644 --- a/panel/components/json-tree/json-tree.js +++ b/panel/components/json-tree/json-tree.js @@ -64,9 +64,14 @@ function batJsonTreeDirective() { var val = object[key]; var fullPath = depth; if (depth) { - fullPath += '.'; + if (Number.isNaN(parseInt(key, 10))) { + fullPath += '.' + key; + } else { + fullPath += '[' + key + ']'; + } + } else { + fullPath += key; } - fullPath += key; var parentElt = angular.element('
  • ' + '' + key + '' +