p:commandButton wait for p:dialog close

UI Components for JSF
Post Reply
User avatar
leofigs
Posts: 5
Joined: 14 Sep 2010, 17:19

30 Sep 2010, 10:02

Hello,

I am trying without success to call an dialog from a p:commandButton and execute the action after the dialog is closed. Is such a thing possible?

For example:

Code: Select all

<p:commandButton ajax="true" onclick="dlgWork.show();" action="#{myBean.myAction}" value="Okdok">
in this case the button would have to open dlgWork and execute the action after the dialog closes.

Why do i need this? I need the dialog to work with a few buttons to gather the same information. I do not want to duplicate the dialog for every button.

Im on JSF 2 - Primefaces 2.1

Thanks.
------------------------------------------------------------------------------------------
Primefaces 2.2.1 - JSF 2 - Mojarra 2.0.3 - Spring 3.0.3 - Tomcat 6.0.29

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Sep 2010, 10:08

Dialog has a closeListener, that might help.

http://www.primefaces.org/showcase/ui/dialogClose.jsf

User avatar
leofigs
Posts: 5
Joined: 14 Sep 2010, 17:19

30 Sep 2010, 10:25

I tried with dialog's closeListener but the button action is still called asyncronously before the listener complete. I tried changing the button's ajax property for true and false too.

If i put the business action in the dialog's listener i would have to duplicate the dialog many times. That's what i am trying to avoid.
------------------------------------------------------------------------------------------
Primefaces 2.2.1 - JSF 2 - Mojarra 2.0.3 - Spring 3.0.3 - Tomcat 6.0.29

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

30 Sep 2010, 11:37

You can try oncomplete callback instead of onclick, by that way you'll show/hide the dialog once commandButton finishes it's job.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 52 guests