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. Any help would be appreciated.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.