It actually is way easier if you just want to close all open popups ;-)

The popup menue closes if you click anywhere outside of it, so placing a hidden 
button somewhere in the layout and use javascript to click it works like a 
charm. If you use a button, click() works at least in IE7 and FF3.6.

Here's a hidden button in the layout:
<input type="button" id="panelPopupClickTarget" style="display: none;" />

Then, you "click" (I call this method with the onclick parameter of the links 
inside the popup which do PPR)
/**
 * Call this method to close the PanelPopup (by faking a click on an invisible 
div)
 * @return
 */
function closePanelPopupAK() {
        var hiddenButton = document.getElementById("panelPopupClickTarget");
        hiddenButton.click();   
}

That's that.


Mit freundlichen Grüßen 

 

Tobias Eisenträger

 

Softwareentwickler

Dokumentenmanagement/Workflow/Internet, AKB 8125 

 

ARAG IT GmbH
ARAG Platz 1, 40472 Düsseldorf

Tel.: +49 (0)211 964-1937

tobias.eisentrae...@arag.de
www.ARAG.de

 

Aufsichtsratsvorsitzender:

Gerd Peskes

Vorstand:

Dr. Paul-Otto Faßbender (Vors.),

Dr. Jan-Peter Horst,

Dr. Johannes Kathan, Werner Nicoll,

Hanno Petersen, Dr. Joerg Schwarze

Sitz und Registergericht:

Düsseldorf, HRB 1371

USt-ID-Nr.: DE 119 355 995


> -----Ursprüngliche Nachricht-----
> Von: Eisenträger, Tobias [mailto:tobias.eisentrae...@arag.de]
> Gesendet: Montag, 22. März 2010 10:23
> An: MyFaces Discussion
> Betreff: AW: Is there a way to close the tr:panelPopup component
> 
> Ok, here is the solution for closing the popup when a dialog opens/PPR:
> 
> // First we need the hook after the PPR
> TrPage.getInstance().getRequestQueue().addStateChangeListener(pprCallback)
> ; /* Trinidad changeListener
>  * After the PPR from trinidad, this method is called.
>  */
> function pprCallback(status) {
>       switch(status)
>       {
>       case TrRequestQueue.STATE_READY:
>         closePopupAk();
>         break;
>       case TrRequestQueue.STATE_BUSY:
>               break;
>       default:
>       }
> }
> 
> function closePopupAk() {
>       var contentId =
> "arbeitskorbDataTable_2_akEintragsMenue_popupContainer";
>       // Get/Initialize a map of visible popups
>       var visiblePopups = TrPanelPopup._VISIBLE_POPUPS;
>       if (!visiblePopups)
>       visiblePopups = TrPanelPopup._VISIBLE_POPUPS = new Object();
> 
>       // Check if the popup is visible
>       if (visiblePopups[contentId]) {
>               var popup = visiblePopups[contentId];
>               popup.hidePopup(null);
>       }
>       return;
> }
> 
> Cheers,
> 
> Tobias Eisenträger
> 
> > -----Ursprüngliche Nachricht-----
> > Von: Eisenträger, Tobias [mailto:tobias.eisentrae...@arag.de]
> > Gesendet: Montag, 22. März 2010 10:04
> > An: MyFaces Discussion
> > Betreff: AW: Is there a way to close the tr:panelPopup component
> >
> >
> > Hello Andrew,
> >
> > Thank you fort that great Tip. But what is he content ID?
> >
> > Thanks,
> >
> > Toby
> >
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Andrew Robinson [mailto:andrew.rw.robin...@gmail.com]
> > > Gesendet: Montag, 8. März 2010 17:59
> > > An: MyFaces Discussion
> > > Betreff: Re: Is there a way to close the tr:panelPopup component
> > >
> > > Have a look at PanelPopup.js
> > >
> > > There is no great API, but it seems that the TrPanelPopup has a hide
> > > method with an event argument that is not used, so it seems to be safe
> > > to pass null. Now to get an instance to the popup object, it looks
> > > like you need to use TrPanelPopup._VISIBLE_POPUPS with the content ID
> > > as the key. It is not pretty, but it should work.
> > >
> > > File an JIRA to add an API for this. The problem is that you may need
> > > to submit a patch yourself, the author of the component has not been
> > > active at MyFaces in a very long time.
> > >
> > > -Andrew
> > >
> > > On Mon, Mar 8, 2010 at 1:01 AM, Eisenträger, Tobias
> > > <tobias.eisentrae...@arag.de> wrote:
> > > > Hello,
> > > >
> > > >
> > > >
> > > > I've been using the tr:panelPopup Component and it worked great so
> > far.
> > > Now I got the problem if I click on a tr:commandLink inside the popup,
> > > which only performs PPR - the panelPopup stays open, for example after
> > > returning from a dialog.
> > > >
> > > >
> > > >
> > > > Does anyone know the javascript to close the tr:panelPopup
> component?
> > > >
> > > >
> > > >
> > > > Toby
> > > >
> > > >
> > > >
> > > >

Reply via email to