You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Eisenträger, Tobias <To...@arag.de> on 2010/03/08 09:01:42 UTC

Is there a way to close the tr:panelPopup component

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

 


Re: Is there a way to close the tr:panelPopup component

Posted by "Dj Apal [GR]" <dj...@gmail.com>.
TrPanelPopup.hidePopup(event); maybe?

2010/3/8 Eisenträger, Tobias <To...@arag.de>

> 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
>
>
>
>

  __o
_\<._
(_)/ (_)

AW: Is there a way to close the tr:panelPopup component

Posted by Eisenträger, Tobias <To...@arag.de>.
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.eisentraeger@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.Eisentraeger@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.Eisentraeger@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.robinson@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
> > > <To...@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
> > > >
> > > >
> > > >
> > > >

AW: Is there a way to close the tr:panelPopup component

Posted by Eisenträger, Tobias <To...@arag.de>.
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.Eisentraeger@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.robinson@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
> > <To...@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
> > >
> > >
> > >
> > >

AW: Is there a way to close the tr:panelPopup component

Posted by Eisenträger, Tobias <To...@arag.de>.
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.robinson@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
> <To...@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
> >
> >
> >
> >

Re: Is there a way to close the tr:panelPopup component

Posted by Andrew Robinson <an...@gmail.com>.
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
<To...@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
>
>
>
>