diff --git a/src/jpl/dijit/GranulesController.js b/src/jpl/dijit/GranulesController.js index 220c9c86..86320429 100644 --- a/src/jpl/dijit/GranulesController.js +++ b/src/jpl/dijit/GranulesController.js @@ -746,6 +746,17 @@ define([ postGranulesFetch: function(response) { this.availableGranules = response.hits; var _context = this; + var currentlyVisibleFootprints = {} + var currentlyVisiblePreviews = {} + + for (var i=0; i 0) { + if (footprintKeys.includes(granuleName)) { + x.footprint = true + // remove object from list + delete currentlyVisibleFootprints[x["Granule-Name"]] + } else { + x.footprint = false + } + } + if (previewKeys.length > 0) { + if (previewKeys.includes(granuleName)) { + x.preview = true + delete currentlyVisiblePreviews[x["Granule-Name"]] + } else { + x.preview = false + } + } + } _context.gridStore.add(x) }); + // remove footprints and previews on the map that are not being shown in the granule table + var objectsToRemove = Object.values(currentlyVisibleFootprints).concat(Object.values(currentlyVisiblePreviews)) + if (objectsToRemove.length > 0) { + _context.toggleFootprints(objectsToRemove, false) + _context.togglePreviews(objectsToRemove, false) + } + this.granulesInGrid = this.gridStore.query().length; // Set no data message accordingly @@ -857,7 +897,6 @@ define([ } return value.toISOString().slice(0, 16); }, - updateStateStoreObj: function(obj) { // If obj has no active states, remove it else upsert if (!obj.footprint && !obj.preview) {