New Invoice

UI Components for JSF
Post Reply
User avatar
oriolmartiribas
Posts: 26
Joined: 24 Feb 2010, 17:15

15 Jun 2010, 13:39

I'm working with dataTable and I would like to make new registers / edit registers with a "p:commandButton" action that will open a "p:dialog (widgetVar="dlg")" to edit / create the register.
It works for editing, but I'm not able to reset the contents of the new register (that is automatically filled with de selection in the dataTable definition):

<p:dataTable ... selection="#{registerController.register}"...>

<p:commandButton value="Edit register" onmousedown="dlg.show()"/>
<p:commandButton value="New register" onmousedown ="dlg.show()" actionListener ="#{registerController.newRegister}"/>

Register Controller
==============
public class RegisterController {
...
public String newRegister() {
register = new Register();
return null;
}
...
}

I don't know what I should do to make the actionListener to go first the dlg.show() comes. (I think :?)
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server

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

15 Jun 2010, 13:47

When new register is clicked, try updating the dialog contents the using oncomplete event, you can display it empty.

User avatar
oriolmartiribas
Posts: 26
Joined: 24 Feb 2010, 17:15

15 Jun 2010, 14:03

Thanks:



<p:commandButton value="New Invoice" actionListener ="#{registerController.newRegister}" oncomplete="dlg.show()" update="dialog"/>

<p:dialog id="dialog" ... widgetVar="dlg" ...>

it works :D

I have still a problem. If I want my p:dialog to be modal (modal=true) everything comes in modal mode (the background window and also the dialog).
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server

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

15 Jun 2010, 18:55

Which PrimeFaces version and browser are you using?

User avatar
oriolmartiribas
Posts: 26
Joined: 24 Feb 2010, 17:15

15 Jun 2010, 19:51

Primefaces 2.0.2 and the browser is Firefox v.3.6.3.
I've also tested with IExplorer and the result is the same.
With Crome is a little different; the dialog doesn't appear.
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server

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

15 Jun 2010, 20:11

Can you double check with the online examples using your browsers?

http://www.primefaces.org:8080/prime-sh ... ogHome.jsf

User avatar
oriolmartiribas
Posts: 26
Joined: 24 Feb 2010, 17:15

16 Jun 2010, 14:03

I've checked the online examples. They work correctly (I've generate a new project on my Netbeans 6.8 and over Glassfish v3)... there is just one thing that I don't understand; with the dialog I only can make one mistake (wrong password,...); after that is like if "actionListener="#{loginBean.login}" is not called anymore (?!?).

Coming back to my problem, I've been verifying how does my program work. Taking out many, many things, I've seen that there is not possible to call the "update="dialog"" in the command that is opening that dialog; in my case:

<p:commabndButton oncomplete="dlg.show()" update="dialog"/> --> doesn't work and let the dialog visible but not operative.
<p:commabndButton oncomplete="dlg.show()"/> --> the modal works right.
:!:
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server

IDukeI
Posts: 1
Joined: 16 Jun 2010, 15:48

17 Jun 2010, 08:39

I have similar problems with modal windows if i have two (or more) different p:dialogs on a page,the dialogs are visible but not operative?!

User avatar
oriolmartiribas
Posts: 26
Joined: 24 Feb 2010, 17:15

17 Jun 2010, 11:19

For me was not a problem of two dialogs.
I just solve the problem taking out a p:layout and a p:calendar of my xhtml; then when I "show()" the dialog in modal mode it works. :?

Now the problem is that I can move the dialog position (in other cases, like the online examples) it is moving without problems.
Somebody know why?
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server

User avatar
oriolmartiribas
Posts: 26
Joined: 24 Feb 2010, 17:15

17 Jun 2010, 12:14

Now the problem is that I can move the dialog position (in other cases, like the online examples) it is moving without problems.
Somebody know why?
The problem was that I open the dialog from a p:commandButton inside a h:form; making the dlg.show() outside de h:form the dialog comes "modal" and I can move it.
There is an equivalent component to p:commandButton to work outside a h:form?
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 44 guests