[IGN-4808] Closing all open popups

My use case is, when a user opens a popup they are still able to resize the web browser which can cause Views to be reloaded if the container size grows or shrinks past its breakpoint. If this happens, I would like to close whatever popups are open at that time.

Is there a way to retrieve a list of all popup id's that are currently open? I could then iterate through the list calling system.perspective.closePopup() on each id.

1 Like

There’s no way to access this information from scripting (at this time), although it would be relatively easy to add; I’ve filed an internal ticket to implement something along these lines.

2 Likes

Has this feature been added?
I have a use case where the customer wants to be able to close all ope popup views via an operator action (button click, menu selection, etc.). So a “close all open popup views” feature would be excellent!

1 Like

Any update on this?

Hello,
I want to close all opened popup without knowing their ID. Is there any way way to to do that?

I have not heard back on this, so I assume that there has been no change.

There has not been any change. When there is, this thread will be updated.

@cmallonee I realize your last post stated this topic would be updated, but I'm hoping that you have some new info since it's been over two years. Is there any way to close all popups without knowing the IDs?

No, we have not made any change to allow for that, although we do have the pen feature request to do so. The original issue was cloned when we switched ticketing systems, so I'll update the ticket number in the title.

2 Likes

I came up with a solution for this that seems to work quite well. My use case is the same as MikeAllgood's.

First, I created a custom session property that I called openPopups, which is an empty array.

Then, to each component that opens a popup, I added a script action to append the ID of the popup being opened to the openPopups session property previously created:

self.session.custom.openPopups.append('IDtoAppend')

Finally, on the event to trigger closing the popups - in my case, a button click - I created a script action which first iterates through all the items of the openPopups array and closes the corresponding popup, then resets openPopups back to an empty array:

# Iterate through and close popups
for i in self.session.custom.openPopups:
    system.perspective.closePopup(i)

# Set openPopups to empty array
self.session.custom.openPopups = []

Works great for me. Hopefully this helps other people as well.

1 Like