How can I capture a click event on a DynamicMapServiceLayer?

440
2
Jump to solution
07-23-2014 03:37 PM
DavidStoddard
New Contributor

I have a DynamicMapServiceLayer and I'd like to fire off a method when someone clicks on it, (like you can with on("click") in a feature layer), is this possible?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
StephenLead
Regular Contributor III

Hi David,

There may be a way to do this directly, but I haven't found it.

Instead I listen for a click event on the map, then loop through the list of Dynamic layers and fire off the method (eg, running a query task).

Steve

View solution in original post

2 Replies
StephenLead
Regular Contributor III

Hi David,

There may be a way to do this directly, but I haven't found it.

Instead I listen for a click event on the map, then loop through the list of Dynamic layers and fire off the method (eg, running a query task).

Steve

View solution in original post

TracySchloss
Frequent Contributor

I agree with Stephen.  Since the API reference doesn't list 'click' as an event, that's your answer right there, you can't do it that way.   I have always used to map click event to either execute a queryTask or identifyTask together with some sort of looping.