From b228330b150fc420e88a52fcfd9ff8a1ce7ac6e2 Mon Sep 17 00:00:00 2001 From: smadha Date: Fri, 6 May 2016 01:15:22 -0700 Subject: [PATCH] fixing all values view in D3 #73 --- geoparser_app/static/js/app.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/geoparser_app/static/js/app.js b/geoparser_app/static/js/app.js index dc08873..c9ebb57 100644 --- a/geoparser_app/static/js/app.js +++ b/geoparser_app/static/js/app.js @@ -159,11 +159,8 @@ $(function() { if (res.response.hasOwnProperty('docs')) { var doc = res.response.docs[0]; var count = 0; - for (var key in metadataFields) { - key = metadataFields[key] - + for (var key in doc) { if (doc.hasOwnProperty(key)) { - count+=1; var value = doc[key]; // Ellipsing the string if its too long if(value.toString().length > 145) { @@ -171,8 +168,10 @@ $(function() { } var child = {"name": key, "children": [{"name": value,"size": 1}]}; d3_data['children'].push(child); + // Max num of default keys to be shown in the popup - if(count <= 4){ + if(count <= 4 && $.inArray(key, metadataFields) > -1){ + count+=1; popup_content += "

" + key + ": " + value + "

"; } }