AnsweredAssumed Answered

Using 2 info window listeners without collisions

Question asked by tligon on Jun 13, 2013
Latest reply on Jun 14, 2013 by tligon
Using the 3.2 library, I have a jQuery button in my infoWindow (which uses the popup dijit); it's rendered by using the following:

dojo.connect(map.infoWindow, "onShow", function(){   $("#myButton").button({     icons: {primary: "ui-icon-link"}, text: false   }).click(function(){     myFunction();   }); });

Button looks great, works great. Then I ran into a situation where there was more than 1 feature associated with the popup; when I clicked the "next" button, the jQuery button face disappeared and the click function stopped working. So I added another dojo.connect statement and listened for the "onSelectionChange" event. Now the button face is OK, but the click function only works when there is more than 1 feature and the user has clicked the "next" or "back" button on the infoWindow. I suspected the events were clashing with each other, so I wrote the following:

require(["dojo/on"], function (on){   on(map.infoWindow, "onShow, onSelectionChange", function(e){     // same jQuery code as above   }); });

Now I get an error: "target must be an event emitter". Suggestions welcome; most efficient solution preferred, but I'll settle for a working solution.