How do you remove a dojo connected event if you do not have the "handle" that was returned during the dojo.connect?

Bear picture Bear · Jul 31, 2009 · Viewed 11.3k times · Source

How do you remove a dojo connected event if you do not have the "handle" that was returned during the dojo.connect?

My example involves dynamically assigning a set of events to a set of objects. (for simplicity, the events are onclick and ondblclick, and the objects are rows within a table)

So, during page setup events are connected to each row (onclick, ondblclick). Now, depending on user desires/actions, a need for removal of one event from one row is required. But the original handle is no longer available. Because of this the following will not work: dojo.disconnect(row, "onclick", ??*). How do I get around this without hacking the original row structure?

Any help is of course greatly appreciated.

Answer

xApple picture xApple · Jan 12, 2011

The answer to your question is that is it impossible to disconnect event if you have lost the "handle" that was returned during the dojo.connect operation. Except if you are ready to do heavy hacking of dojo code itself.

You must store these somewhere if you wish to disconnect them later on.