I need to be able to close all open popups when the page is changed, so I need to be able to get a list of all of the open popup ids, but I'm struggling to find how I would do this.. help!
Edit: I have a dodgy solution.. just call system.perspective.closePopup('') a number of times...
you could either manage a list of ids and then close them that way
or for each popup just have a message handler that is the same on all of them that runs system.perspective.closepopup for the id. you'd still likley have to put the popup id into each respective one
It looks like it isn't possible without some management effort on my part which is susceptible to being forgotten, particularly if other devs are involved who simply aren't aware.
I'll keep my spam call of closePopup("") for now as this does work, it just feels wrong..
I find the message option quite easy to implement, without requiring any special kind of management, all you need is a parameter with the popup's id.
Then popups are responsible for closing themselves when catching the message.
This gives you a lot of flexibility:
Don't implement the handler on a particular popup if it should stay open
Add some context to the message through the payload for conditional handling
I do both of these already, the 2nd one kind of for device popups. I have a single popup that I use for all device types (motors/valves/analogues/etc) that has a standard set of tabs with some that hide based on device type. The tab contents for some of them are defined within separate Views, while other more standard tabs like trends, interlocks, alarms etc. are all defined within the popup itself. So I actually don't have a lot of popups.. but still