ClusterLayer.js popup problem

5437
11
02-13-2015 07:59 AM
NEvatt
by
New Contributor III

Hello,

I am currently using the ClusterLayer.js file to create clustered points as in the example here.  I am very happy with the results within a the JavaScript Api, but I am now trying to use it within a custom widget in the Web AppBuilder.  It works almost perfectly except for one problem, the popup window closes on its own within about a second of opening it.  I can't find any errors and have done everything I can think of to single out the issue with no luck.  Has anyone experienced something similar before?

I was thinking that potentially there was an issue with between the infowindow popup and the PopupTemplate that is used in the demo, but I tried using the InfoWindow popup instead, but that didn't fix it either.

I have posted my code for the widget.js file here, however, I am currently unable to post a link because the firewall set-up that we have in our company.

Thanks,

Nat

0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus

N Evatt,

   I suspect that it might have something to do with the setInfoWindowOnClick on the map object. Try adding

theMap.setInfoWindowOnClick(true);

0 Kudos
NEvatt
by
New Contributor III

Hi Robert,

I had a go with the setInfoWindowOnClick, but no luck.  Interestingly, I set the boolean value to false just to test that it was working, but there was no change in behaviour.  The popup still opened for 1 second and then closed.  I should just be able to place the setInfoWindowOnClick call anywhere inside the widget.js file right?  I am not sure why I was unable to turn off the onlick.

Thanks for your help as always.

0 Kudos
NEvatt
by
New Contributor III

I had a thought.  I have noticed that I get similar behaviour from a popup opening and closing when I click on the map where there is no data, except that the popup message says "No information available".  Could there be a setting that closes non-map layer data popups quickly in that manner?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Nat,

   Have you tried to do just a simple JS API app using the same exact clusterlayer configuration to see if the popups work as expected?

0 Kudos
NEvatt
by
New Contributor III

Hi Robert,

Yes, I have created a JS API version with sample data and my own and it works as expected.  This is why I find the WAB difficulties particularly confusing. 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Nat,

   Sorry I am at a loss on this. I do know that they will have some popup issues fixed in the next release next month.

0 Kudos
ChrisSmith7
Frequent Contributor

If you haven't had a chance to debug ClusterLayer.js in your browser, I'd have a look at the "onClick" method... there's a line that should open the info window:

this._map.infoWindow.show(e.graphic.geometry);

Once you're debugging, try placing a breakpoint on the "show", "hide", and "destroy "methods of the "esri/dijit/Popup" class in init.js to see if there's anything funky going on (possibly hide is getting called somehow?). If you find that hide is getting called, maybe the click is bubbling up to the map... once you're in "hide", if that's the case, try unraveling the call stack to see if that's occurring. If it is bubbling up, I'm guessing it's triggering the hide method, which gets called when you click anywhere on the map (to dismiss the pop-up/points).

NEvatt
by
New Contributor III

Hi Chris,

So I feel a bit thick on this one, but I can't figure out how to get the break points to work on minimized code within Chrome Dev Tools.  I think that esri/dijit/InfoWindow is actually what is being called in my set up, but none of the break points seem to do anything.  Any advice on that?

Using your advice however, I have gotten one step closer.  In the onclick function of clusterLayer, I have turned off e.stopPropagation() which displays all the photo icons, and then if I select an icon, they stay open as long as needed.  It is not perfect because there is still a message that says "No Information Available" first, but I think I am close.

Thanks,

Nat

0 Kudos
ChrisSmith7
Frequent Contributor

I tend to use IE11 for debugging since it's what our clients mostly use. I like Chrome since you can change JavaScript on-the-fly, but am more familiar with IE11's dev tools, which allow you to pretty-print JS (ctrl+shift+p) - that makes it quite a bit easier to read and debug.

0 Kudos