Select to view content in your preferred language

visiblelayers change event?

1221
1
09-23-2014 08:45 AM
JoanneMcGraw
Frequent Contributor

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

0 Kudos
1 Reply
JoanneMcGraw
Frequent Contributor

Well, this is rather funny... apparently I asked the same question 2 years ago and never got an answer.

https://community.esri.com/message/65594?sr=search&searchId=f6d83fcd-a437-4b3a-83f1-1a6b7d866c00&sea...

I guess it's more difficult than I thought

0 Kudos