Ignition 8.1.20, Perspective:
I'm curious what the best practice is for closing the respective popup which contains a 'Close Popup' button? ...if a popupId is not known? ...if the 'Close Popup' button exists within an Embedded View of that popup?
Per insight from link below, we are using a script action within onActionPerformed of a Button object.
I forgot to mention, there is an issue with the aforementioned script we are using, whereby the 'Active Popup' closes instead of the parent popup containing the button.
This issue rears its ugly head only when multiple popups are open, and when the user clicks quickly on the close button of an inactive popup.
The native X button of the Popup does not care about the ID - that's the browser operating on HTML components without regard for their content. If you want Perspective to operate on a Popup, you really need to provide the ID of the Popup. I recommend that every time you open a Popup you do so one of two ways:
Using a Script Action or Popup Action, pass the identifier used for the Popup as a param to the View. Then from within the View, any Button should reference that id param of the View. If you need to have your "close" button in an Embedded View of this View, then you need to continue passing the param down the chain. This is the best approach because No View is responsible for hanging onto some ID that might be changed elsewhere.