Disable resulting Pop-up after running URL Query Parameter

1445
6
07-13-2017 04:08 PM
MattReeves
New Contributor III

As the title says, I would like to disable the resulting pop-up after running a Query URL Parameter.....

The pop-up seems to be tied to the selection of the feature that you just queried on, so if you close the pop-up, the selection of the feature is also cleared.

Ideally, what I would like to see is the Query URL Parameter zooms to the expected feature, the feature is highlighted, but the pop-up is not displayed.

Example our our URL Parameter: ApplcationURL/?query=Parcels,PID_NUM,35182.4506 

Tags (2)
0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus

Matt,

   The problem will be that the popup is what gives the query the highlight of the result. If you do not have the popup then the map will just zoom to the result. If that is acceptable then the code change you need to make is to the jimu.js MapUrlParamsHandler.js (comment out lines 4-12 as below):

  function showSelections(map, layer, features){
    if(!map.getLayer(layer.layerInfo.id)){//feature layer doesn't exist in map
      var infoTemplate = layer.layerInfo.getInfoTemplate();
      // if(!infoTemplate){
      //   layer.layerInfo.loadInfoTemplate().then(function(it){
      //     setFeaturesInfoTemplate(it);
      //     doShow();
      //   });
      // }else{
      //   setFeaturesInfoTemplate(infoTemplate);
      //   doShow();
      // }
    }else{
      doShow();
    }
0 Kudos
MattReeves
New Contributor III

Thank you for your response Robert!

I had thought that the alteration might occur in this MapURLParamsHandler.js file based on a similar response of yours here on GeoNet. Unfortunately, we need to have the feature highlight, so I think we will have to go the JavaScript route to come up with a solution. I do greatly appreciate your response, and it is useful information to know that a person can implement the Query URL Parameter, zoom to a feature, and have the pop-up not display.

0 Kudos
KyleSchwizer
New Contributor III

Matt,

We are trying to accomplish the same thing you are. Did you end up finding a way to highlight the selection without displaying the popup? We are able to disable the popup as Robert had shown above but we would still like to have the selection highlighted.

ChrisSands
New Contributor II

I know it's been years since this question was posted, but I had the same question and worked out an answer. The doShow() function has two lines. The first highlights the feature and the second shows the popup. I made another function called doShowNoPopup() that just has that first line, map.infoWindow.setFeatures(features);. Then I call doShowNoPopup() from ShowSelections().

BryanPreston
New Contributor III

Hi ChrisSands,

I was hoping you'd be able to elaborate on what you are saying here. I tried commenting out the lines mentioned in the first reply above (not yours), but that didn't work. 

Can you point out where in the code to add your doShowNoPopup() and what exactly to add?

BryanPreston_0-1659041493988.png

 

 

0 Kudos
ChrisSands
New Contributor II

In the code you have included, there is a function called doShow(). If you always want to not show the popup, just comment out or delete the second line of code in that function. That will have the effect of zooming to the feature, but not turning on the popup. That's the simplest solution.

Alternatively, since the showSelections() function has three different instances where it calls doShow(), you have an opportunity for one or more of those instances to call doShow() as it is already to zoom to the feature and show the popup or to call a new function that would zoom to the feature and not show the popup. I added a function called doShowNoPopup() for this second purpose.

function doShowNoPopup(){
  map.infoWindow.setFeatures(features);
}

Then in showSelections (), replace one or all of the the doShow() calls with doShowNoPopup(). This solution has the advantage of keeping doShow() in place so that other functions may call it with the original functionality.

0 Kudos