You should use dojo/on for your event handling. From the Events section in the documentation:
Using the on
method is preferable to using connect
for several reasons. First, the Dojo documentation states that connect
support will be removed in Dojo 2.0, and in fact, connect
is now a legacy convenience wrapper for dojo.on
. Secondly, especially in AMD style, it makes your code less verbose and is more similar to event attachment syntax in other JavaScript frameworks. Finally, for esri
components we add a target
property to all "synthetic" events (not mouse or key events) which points to the component which fired the event.
"dojo/on" contains the function "once", which can be set so the event only happens once and is removed afterward.
Reading your question again, are you expecting disconnect to remove the layer? If so, you'll have to do that with the removeLayer method. Disconnect just removes the event handler (meaning if you click on the button again, it won't fire the function to add the map layer.