A layer (or even individual graphics) can have an info template that describes the content of the infowindow, but I want different layers to have different size info windows. Is it possible for layers to specify the size of the info window used when clicking on their graphics? Mostly I want to make sure that layers that don't specify a size don't get the super-wide info window I want for one of my layers.
Solved! Go to Solution.
You can do this. I don't know if there are additional ways of doing this but I do this using a click event handler for each layer:
theLayer.on("click", function(evt) { map.infoWindow.resize(350, 275); });
If you wanted to reset the infoWindow back to a default size, you can do that in a similar manner:
map.infoWindow.on("hide", function(evt) { map.infoWindow.resize(400,300); });
Just tweak the height/widths until you're happy.
Steve
You can do this. I don't know if there are additional ways of doing this but I do this using a click event handler for each layer:
theLayer.on("click", function(evt) { map.infoWindow.resize(350, 275); });
If you wanted to reset the infoWindow back to a default size, you can do that in a similar manner:
map.infoWindow.on("hide", function(evt) { map.infoWindow.resize(400,300); });
Just tweak the height/widths until you're happy.
Steve
That's a clever way of adjusting the infowindow size. I was hoping there was a way for a layer to request that on its own (similar to the way the info template works). I will do this if there is no API way of making this happen.
It's the way I've always done it but I don't know if it's the right way.
As far as I know this is the only way to do it.