exception in animation handler for: onEnd...?v=2.8 (line 14) TypeError: _69.color is Null...Legend.xd.js (line 19)
dojo.addOnLoad(init);
var mapLayers = [];
var legendLayers = [];
//Function to initialize the map and read data from Configuration file
function init() {
setupFindTask();
//asp.net proxy page for token service
esri.config.defaults.io.proxyUrl = "proxy.ashx";
//change the location of the map slider
esri.config.defaults.map.slider = { left:"13px", top:"76px", width:null, height:"150px" };
//change zoom options to try and get map to display faster
esri.config.defaults.map.zoomRate = 50;
esri.config.defaults.map.zoomDuration = 1000;
dojo.connect(map, "onLoad", mapLoaded);
dojo.connect(grid1, "onRowClick", onRowClickHandler);
//lets grab the details from the config.txt file
dojo.xhrGet({
url: "Config.txt",
handleAs: "json",
preventCache: true,
load: function (responseObject, ioArgs) {
var mapExtent = responseObject.DefaultExtent;
defaultID = responseObject.defaultID;
defaultFacName = responseObject.defaultFacName;
defaultFacCityState = responseObject.defaultFacCityState;
var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]),
parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), new esri.SpatialReference({ wkid: 102100}));
dojo.byId('imgApp').src = responseObject.ApplicationImage;
dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName;
map = new esri.Map("map", { extent: startExtent});
createBasemapGallery();
dojo.connect(map, "onLoad", MapInitFunction);
}
});
}
//map layers can be added here
function MapInitFunction(map) {
var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'facils',
outFields:["*"]
});
legendLayers.push({layer:facils,title:"Facilities"});
var bndry = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/3",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'bndry',
opacity: 0.7,
outFields:["*"]
});
legendLayers.push({layer:bndry,title:"Boundary"});
var props = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/2",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'props',
outFields:["*"]
});
legendLayers.push({layer:props,title:"Property Boundaries"});
dojo.connect(map,'onLayersAddResult',function(results){
var legend = new esri.dijit.Legend({
map:map,
layerInfos:legendLayers
},"legendDiv");
//when the map extent is changed, refresh legend layers since layerInfos is used in legend constructor
dojo.connect(map, "onExtentChange", function(){
legend.refresh();
});
legend.startup();
});
map.addLayers([bndry,props,facils]);
dojo.connect(map,'onLayersAddResult',function(results){
//add check boxes
dojo.forEach(legendLayers,function(layer){
var layerName = layer.title;
var checkBox = new dijit.form.CheckBox({
name: "checkBox" + layer.layer.id,
value: layer.layer.id,
checked: layer.layer.visible,
onChange: function(evt) {
var clayer = map.getLayer(this.value);
clayer.setVisibility(!clayer.visible);
this.checked = clayer.visible;
}
});
//add the checkbox and label to the toc
dojo.place(checkBox.domNode,dojo.byId("toggle"),"after");
var checkLabel = dojo.create('label',{'for':checkBox.name, innerHTML:layerName},checkBox.domNode,"after");
dojo.place("<br />",checkLabel,"after");
});
});
}In firebug, I get this error when I zoom to the visibility scale of the 'props' layer:exception in animation handler for: onEnd...?v=2.8 (line 14) TypeError: _69.color is Null...Legend.xd.js (line 19)
If I remove the props layer from both the map and legend objects, the error is gone.
Here's what I have:dojo.addOnLoad(init); var mapLayers = []; var legendLayers = []; //Function to initialize the map and read data from Configuration file function init() { setupFindTask(); //asp.net proxy page for token service esri.config.defaults.io.proxyUrl = "proxy.ashx"; //change the location of the map slider esri.config.defaults.map.slider = { left:"13px", top:"76px", width:null, height:"150px" }; //change zoom options to try and get map to display faster esri.config.defaults.map.zoomRate = 50; esri.config.defaults.map.zoomDuration = 1000; dojo.connect(map, "onLoad", mapLoaded); dojo.connect(grid1, "onRowClick", onRowClickHandler); //lets grab the details from the config.txt file dojo.xhrGet({ url: "Config.txt", handleAs: "json", preventCache: true, load: function (responseObject, ioArgs) { var mapExtent = responseObject.DefaultExtent; defaultID = responseObject.defaultID; defaultFacName = responseObject.defaultFacName; defaultFacCityState = responseObject.defaultFacCityState; var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]), parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), new esri.SpatialReference({ wkid: 102100})); dojo.byId('imgApp').src = responseObject.ApplicationImage; dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName; map = new esri.Map("map", { extent: startExtent}); createBasemapGallery(); dojo.connect(map, "onLoad", MapInitFunction); } }); } //map layers can be added here function MapInitFunction(map) { var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{ mode:esri.layers.FeatureLayer.MODE_SNAPSHOT, id: 'facils', outFields:["*"] }); legendLayers.push({layer:facils,title:"Facilities"}); var bndry = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/3",{ mode:esri.layers.FeatureLayer.MODE_SNAPSHOT, id: 'bndry', opacity: 0.7, outFields:["*"] }); legendLayers.push({layer:bndry,title:"Boundary"}); var props = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/2",{ mode:esri.layers.FeatureLayer.MODE_SNAPSHOT, id: 'props', outFields:["*"] }); legendLayers.push({layer:props,title:"Property Boundaries"}); dojo.connect(map,'onLayersAddResult',function(results){ var legend = new esri.dijit.Legend({ map:map, layerInfos:legendLayers },"legendDiv"); //when the map extent is changed, refresh legend layers since layerInfos is used in legend constructor dojo.connect(map, "onExtentChange", function(){ legend.refresh(); }); legend.startup(); }); map.addLayers([bndry,props,facils]); dojo.connect(map,'onLayersAddResult',function(results){ //add check boxes dojo.forEach(legendLayers,function(layer){ var layerName = layer.title; var checkBox = new dijit.form.CheckBox({ name: "checkBox" + layer.layer.id, value: layer.layer.id, checked: layer.layer.visible, onChange: function(evt) { var clayer = map.getLayer(this.value); clayer.setVisibility(!clayer.visible); this.checked = clayer.visible; } }); //add the checkbox and label to the toc dojo.place(checkBox.domNode,dojo.byId("toggle"),"after"); var checkLabel = dojo.create('label',{'for':checkBox.name, innerHTML:layerName},checkBox.domNode,"after"); dojo.place("<br />",checkLabel,"after"); }); }); }
anyone see this problem before?
edit: The problem seems to start at v2.7; changing to v2.5 or v2.6 there is no error, and everything works fine.
I am guessing your props layer is poly's with null fill. I wonder if that is causing the bug. Try going to the Legend of the rest service directly and see if you get the error in firebug.
exception in animation handler for:onEnd RangeError: Array length must be a finite positive integer