Select to view content in your preferred language

Capturing the onClick event of a map when a graphics layer is present

3487
2
Jump to solution
01-29-2014 07:24 AM
jamesmuir
Deactivated User
I have an identify tool that listens for the onClick event of the map like so

handle = dojo.connect(mapController.map, 'onClick', function (evt) {...}


When i run a query against the map i am highlighting the returned features by adding the geometries as graphics to a map like so

         
var layerId = "query-graphics-layer"           var queryGraphicsLayer = new esri.layers.GraphicsLayer({id: layerId});            map.addLayer(queryGraphicsLayer);            //Add the graphics to the query-graphics-layer           $.each(queryFeatureSet.features, function( index, feature) {             queryGraphicsLayer.add(new esri.Graphic(feature.geometry, feature.symbol));           });


The problem is that when i go to click on the feature to get the identify, the onClick event of the map does not fire. I tried to use

queryGraphicsLayer.disableMouseEvents();


but that didn't work. It appears that the graphics in the graphics layer is taking the click event and that it is not getting propagated to the map which seems to be by design

http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm#jshelp/...

However, i would like to know if there is some way to allow that event to propagate up to the map or possibly a way to propagate it myself?
0 Kudos
1 Solution

Accepted Solutions
jamesmuir
Deactivated User
It turns out that my implementation was using a feature set which was causing the problem. Once i changed it to a graphics layer the map captured the event. Thank you for your reply.

View solution in original post

0 Kudos
2 Replies
JohnathanBarclay
Regular Contributor
I'm not sure how you are running your query, but the best way would probably be to use FeatureLayer with a selection symbol set.

You can then use the selectFeatures method to highlight features using a query.
0 Kudos
jamesmuir
Deactivated User
It turns out that my implementation was using a feature set which was causing the problem. Once i changed it to a graphics layer the map captured the event. Thank you for your reply.
0 Kudos