JS API Error upgrading to 3.16+ from 3.11

664
1
Jump to solution
11-01-2016 08:47 AM
ChuckBenton
Occasional Contributor

I'm developing an App based on the Tax Parcel Viewer solution: Tax Parcel Viewer | ArcGIS for Local Government .  My variant has been running using JS API 3.11.

I now need to add a multi-property report, and FeatureTable capability as used in
https://developers.arcgis.com/javascript/3/jssamples/featuretable_custommenu.html is an ideal solution. The featureTable functionality requlred is not available in 3.11, but is in 3.16+.

I've tried to get my variant of TaxParcelViewer running under 3.16, 3.17, and 3.18.

In all cases I get the following error: Type Error: a.id.match is not a function.

This is at map.addLayer on line 457, which runs without error under 3.11.

Any suggestions on how to resolve this error?

Chuck

0 Kudos
1 Solution

Accepted Solutions
ChuckBenton
Occasional Contributor

Per my favorite ESRI analyst:

I tested it and I noticed that the issue is actually coming from the js/locator.js file in line 698, , acutally there is a code defect, since sometime map.getLayer(neighbourHoodLayerInfo.id) is undefined, and in  js api 3.11,it is not that sensitive, but in 3.18 it is more restrict on the code, so what you will need to do is just add another if statement outside of this if, so then it should look like this(I highlited the code that I added in line 697) :
line 696        for (var i in neighbourHoodLayerInfo) {
line 697                        if (neighbourHoodLayerInfo.hasOwnProperty(i)&&map.getLayer(neighbourHoodLayerInfo.id)) {
line 698                                  if (map.getLayer(neighbourHoodLayerInfo.id).maxScale <= ((mapScale) ? mapScale :              
                                                  Number(dojo.byId("divShareContainer").getAttribute("mapScale"))) &&                      
                                                  map.getLayer(neighbourHoodLayerInfo.id).minScale >= ((mapScale) ? mapScale :
                                                   Number(dojo.byId("divShareContainer").getAttribute("mapScale")))) {
line 699                         PopulateNeighbourHoodInformation(neighbourHoodLayerInfo, mapPoint, null);
            }
        }
    }

That fixed it!

View solution in original post

0 Kudos
1 Reply
ChuckBenton
Occasional Contributor

Per my favorite ESRI analyst:

I tested it and I noticed that the issue is actually coming from the js/locator.js file in line 698, , acutally there is a code defect, since sometime map.getLayer(neighbourHoodLayerInfo.id) is undefined, and in  js api 3.11,it is not that sensitive, but in 3.18 it is more restrict on the code, so what you will need to do is just add another if statement outside of this if, so then it should look like this(I highlited the code that I added in line 697) :
line 696        for (var i in neighbourHoodLayerInfo) {
line 697                        if (neighbourHoodLayerInfo.hasOwnProperty(i)&&map.getLayer(neighbourHoodLayerInfo.id)) {
line 698                                  if (map.getLayer(neighbourHoodLayerInfo.id).maxScale <= ((mapScale) ? mapScale :              
                                                  Number(dojo.byId("divShareContainer").getAttribute("mapScale"))) &&                      
                                                  map.getLayer(neighbourHoodLayerInfo.id).minScale >= ((mapScale) ? mapScale :
                                                   Number(dojo.byId("divShareContainer").getAttribute("mapScale")))) {
line 699                         PopulateNeighbourHoodInformation(neighbourHoodLayerInfo, mapPoint, null);
            }
        }
    }

That fixed it!

0 Kudos