AnsweredAssumed Answered

visiblelayers change event?

Question asked by myESRIUName on Sep 23, 2014
Latest reply on Sep 23, 2014 by myESRIUName

Is there such a thing as a visiblelayers change event? I would have thought so, but I've been looking around in the docs for an hour and can't find anything.

 

There's a "visibility-change" event but that's only fired when the visibility on the entire service is toggled on/off. What I'm looking for is an event I can listen for to know if some code somewhere has called setVisibleLayers on the service and changed which layers within the service are visible.

 

The only idea I can come up with is that I have to keep my own copy of the array of current visiblelayers that I compare whenever there is an "update-end" instead and, if there is a change, do my thing. However, I can't believe there's no event triggered by the JSAPI when this happens...I think I just can't find it because it's not where I'm expecting it to be.

 

Any pointers anyone?

 

Cheers,

jtm

Outcomes