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.
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.
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!
@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.
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:
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.
Checking in a year later, is there still no way to close all popups without knowing their IDs? I see the solution above but I was looking for a more straightforward way. Thanks.