Geocoder Widget Bug Fix

2717
2
04-03-2015 10:01 AM
deleted-user-YYhuCJuuEn9L
New Contributor III

Hello WAB Dev Team,

Just FYI, I think it may be necessary to modify this line in the showResults method of the Geocoder widget. A subLayerId of 0 is falsy so the feature.infoTemplate end up being null and it's infoTemplate is not recognized. As a workaround I had to change the index of the subLayer with the infoTemplate so that it's subLayerId would be 1.

0 Kudos
2 Replies
StanMcShinsky
Occasional Contributor III

Ryan,

I am interested in what you are doing here. Can you explain more about the sublayerid and what you changed in your code? From the looks of it I can't see any difference in the code you provided and the code in the Dev version 1.1 unless I am just missing it.

-Stan

0 Kudos
deleted-user-YYhuCJuuEn9L
New Contributor III

I didn't make any changes to the code. I'm suggesting that the Dev team look into it. I had an issue here because I have a web map with a map service. I'm using the first layer within the map service for searching. What I understand to be occurring in the code block provided is:

  • The 'feature.infoTemplate' value is set to the layer's infoTemplate property if it exists which it doesn't in my case because the layer is an ArcGISDynamicMapServiceLayer which has no infoTemplate property.
  • The expression then evaluates the line that I highlighted which I believe was intended to determine if the activeGeocoder.subLayerId exists (i.e is not null or undefined). Because the subLayerId in my case is 0, both sides of the '||' in the expression are falsy so null is assigned to  'feature.infoTemplate'. In the following code block the  'feature.infoTemplate' is interpolated which is not what I want.

My workaround was to make the search layer the second layer in the web map so that activeGeocoder.subLayerId is 1 and the expression evaluates properly.

0 Kudos