I am using FeatureLayers in the API to load in a layer. I have an info template set for the layer for identifying individual features.

I am trying to disconnect the click event from the layer while I am drawing a polygon for another tool. However, I haven't found a good way to disconnect that handler since it isn't one I assign.

I have tried layer.disableMapEvents() which didn't work. I don't have an info template set for the map itself either, so I don't think that one is firing.

I have searched through some other posts here, and so far the only solution I have found is to attach another handler to the map click event and call map.infoWindow.hide() while I am doing the drawing. This still goes through the identify process but keeps the window away.

I also tried calling the map.graphics.disableMouseEvents(), but that doesn't work either.

I am looking for a way to either handle the map click event myself and disconnect ESRI's standard way for the FeatureLayer. I just want to be able to shut off identifying of features temporarily.

A way to disconnect the event and hook it up again would be great. That would help if I want to attach it to another mouse event, too.


3 Answers 3


i'm not sure why .disableMouseEvents() stopped working after 3.9, but you can use map.setInfoWindowOnClick() instead.

here's a working sample.

  • This is exactly what I was looking for! I am disappointed I missed it in their documentation.
    – Branco
    Nov 4, 2014 at 18:09
  • IMO easy to miss cause its a method of the map and not the FeatureLayer itself. glad i could help. Nov 5, 2014 at 19:11

This sample may help you. I don't think you should need disableMouseEvents or disableMapEvents. I was able to use this to keep map click events separate from selecting features and managed to build a few other things on as well.

The initSelectToolbar function runs once after clicking the button and then finishes after selecting features (but I think drawing a polygon could be done here too). The button does need to be pressed again for each new polygon.

Feature Layer with Selection (Sample)


using dojo/on.pausable is a cool way to handle stopping and starting the listening of events.

this.identifying = on.pausable(this.map, 'click', (evt) => this.onMapClick(evt));

and then when you want to draw or something

if (!active) {
  return this.identifying.pause();


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.