From 16a71f7cd05d1c7e45136c251283266a0ddbc0c6 Mon Sep 17 00:00:00 2001 From: Tung Jin Chew Date: Thu, 9 Mar 2017 13:37:16 +0000 Subject: [PATCH] Fix dategraph not updating if you change the date restrictions while it's not active --- .../app/page/search/results/dategraph/dategraph-view.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webapp/core/src/main/public/static/js/find/app/page/search/results/dategraph/dategraph-view.js b/webapp/core/src/main/public/static/js/find/app/page/search/results/dategraph/dategraph-view.js index 76c74c533a..9eb4b1fc5d 100644 --- a/webapp/core/src/main/public/static/js/find/app/page/search/results/dategraph/dategraph-view.js +++ b/webapp/core/src/main/public/static/js/find/app/page/search/results/dategraph/dategraph-view.js @@ -122,6 +122,9 @@ define([ }, update: function() { + if(this.$el.is(':visible')) { + this.updateGraph(); + } }, updateGraph: function() { @@ -188,7 +191,10 @@ define([ }, fetchBuckets: function() { - var width = this.$('.dategraph-content').width(); + // We now use the width of the closest visible ancestor, even if this tab itself is currently hidden, + // since the filters may change when we're not looking at the screen; which gives zero width for + // the SVG if it's not on the screen, but we still need data. + var width = this.$('.dategraph-content').closest(':visible').width(); // If the SVG has no width or there are no values, there is no point fetching new data // if(width !== 0 && this.model.get('totalValues') !== 0) {