Simple question. I placed this.own(on(this.map, "click", lang.hitch(this, this._onMapClick))); in postCreate to start my widget listening for mouse clicks. How to I undo this command on widget onClose?
Thanks.
Solved! Go to Solution.
Chet,
It is as simple as assigning a var to the listener:
this.own(this.clickEvtHandler = on(this.map, "click", lang.hitch(this, this._onMapClick)));
...
onClose: function(){
this.clickEvtHandler.remove();
...
Chet,
It is as simple as assigning a var to the listener:
this.own(this.clickEvtHandler = on(this.map, "click", lang.hitch(this, this._onMapClick)));
...
onClose: function(){
this.clickEvtHandler.remove();
...
Thanks.
I found this worked but modified for version 3.x
onOpen
this._clickEvt = this.map.on("click", lang.hitch(this, this._onMapClick));
onClose
this._clickEvt.remove();
Chet,
WAB is v3.x of the API...? Also I know that code works fine in a widget, as I have it working in some of mine. Anyway don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.