Listener for layer toggle widget

5759
68
Jump to solution
07-20-2018 07:37 AM
MarkLache1
Occasional Contributor

How would I add a listener to Robert's layer toggle widget that would be able to tell what layer is on? I want this so that the info can be passed into Survey123 via custom URL

Thanks

0 Kudos
68 Replies
RobertScheitlin__GISP
MVP Emeritus

Mark,

Did you check the value of layer.id?

0 Kudos
MarkLache1
Occasional Contributor

Appears to be undefined

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

So your layer does not have an id or is the layer itself null?

0 Kudos
MarkLache1
Occasional Contributor

I looked at the Item ID from the AGOL Assistant and one shows there. Same as Layer ID?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

But in the topic event the layer does not have an id?

0 Kudos
MarkLache1
Occasional Contributor

Debugger didn't show that...not the best in FireFox

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

So use Chrome then.

0 Kudos
MarkLache1
Occasional Contributor

Just got approval for Chrome. Where am I looking in the Scope?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Once you hit your breakpoint you can just hover over a var and see the objects properties.

0 Kudos
MarkLache1
Occasional Contributor

in the publishMapEvent function:

-this.SERVICE_ID is null

-no layer is defined somehow

See attached

0 Kudos