I am struggling with this most basic operation ... please help!
Here is code snippet I am working with :
$("#grayPic").click(function() { //eventually, this will render all layers in the map invisible
var allGuys = map.allLayers;
var i, currentLayer;
for (i = 0, l = allGuys.length; i < l; i++) {
currentLayer = allGuys[i];
currentLayer.visible = false;
};
});
Solved! Go to Solution.
John,
Sorry change it to:
$("#grayPic").click(function() {
//eventually, this will render all layers in the map invisible
map.allLayers.forEach(function(layer){
layer.visble = false;
};
});
currentLayer.hide()
Still no luck ...
Map.js:264 Uncaught TypeError: Cannot read property 'hide' of undefined
John,
Try this:
$("#grayPic").click(function() {
//eventually, this will render all layers in the map invisible
map.allLayers.forEach(function(item){
item.hide();
};
});
Map.js:412 Uncaught TypeError: item.hide is not a function
at Map.js:412
at Object.e.forEach (dojo.js:210)
at HTMLImageElement.<anonymous> (Map.js:411)
at HTMLImageElement.dispatch (jquery-1.12.4.js:5226)
at HTMLImageElement.elemData.handle (jquery-1.12.4.js:4878)
John,
Sorry change it to:
$("#grayPic").click(function() {
//eventually, this will render all layers in the map invisible
map.allLayers.forEach(function(layer){
layer.visble = false;
};
});
Yep!
Thanks again Robert ... works perfectly.