0

I am creating a Custom Popup template as follows:

countyPop = new PopupTemplate({
 title: "County: {NAME}",
 fieldInfos: [{ 
 fieldName: "POP2000",
 label: "2000 Pop",
 visible: true
 }, {
 fieldName: "POP2010",
 label: "2010 Pop",
 visible: true
 }]
 });

This popup works fine and is firing when I click the layer. However, I have some javascript to switch out the layers and when I hide this layer and show a different shape layer the popup still hangs around.

How can I stop displaying this popup when I switch to a different layer?

I tried

countyPop.hide(); 

It states there is a hide method in infoWindow but that does nothing. No error is produced and the popup is still there.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jan 29, 2014 at 23:24

1 Answer 1

2

Use:

map.infoWindow.hide();

to hide and close the popup. Popup templates do not have a hide method as they specify how content is displayed, not whether the popup itself is visible.

answered Jan 30, 2014 at 22:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.