Select to view content in your preferred language

4.14 Search widget - autoNavigate and resultGraphicEnabled being ignored

754
4
04-13-2020 01:48 PM
davetinkle
Occasional Contributor

I want to mange the display of my graphic when returning from search [event: "search-complete"], but I can see immediately when I put a break inside returning from this event the MapView has put focus on the geometry, and put a black circle. Both actions cannot be interrupted. I've tried just about every permutation of options to prevent default behavior, and nothing in my console or other logs indicate I've done something wrong. Adding insult to injury, the mapped point is not part of any obvious layer, so I cannot control removing it even after everything settles in.

relevant block of code:

var US_Only = [{
   autoNavigate: false,
   locator: new Locator({
      url: "//" + '<%= Configuration.getConfigurationValue(Constants.ESRI_GEOCODE_SVC_EP) %>'
   }),
   maxResults: 1,
   singleLineFieldName: "SingleLine",
   countryCode: "US",
   outFields: ["addr_type", "score", "match_addr"]

}];
   

searchWidget = new Search({

   autoSelect: false,
   sources: US_Only,
   popupEnabled: false,
   resultGraphicEnabled: false
});

searchWidget.on("search-complete", function(retobj) {

   // retobj has everything I need -- and will control rendering/plotting -- but at this point the result is rendered, which I do NOT want

});

Tags (1)
0 Kudos
4 Replies
Noah-Sager
Esri Regular Contributor

Hi, can you post a hosted sample (like on codepen or jsbin) that shows this behavior?

I tested these properties at 4.15 and they both appear to work as expected: https://codepen.io/noash/pen/WNQQKaM 

0 Kudos
davetinkle
Occasional Contributor

Hi Noah,

Would you mind doing something similar for the version i'm currently using -- stated as 4.14 in the thread title?

Thanks.

0 Kudos
Noah-Sager
Esri Regular Contributor

For sure. I tested these properties at 4.14 and they both appear to work as expected:

https://codepen.io/noash/pen/eYppPay 

0 Kudos
davetinkle
Occasional Contributor

Thanks Noah.

I have to make adjustments to add a graphic to my MapView, and not add it to a FeatureLayer [and in turn add to Map]