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 )
New Invoice
- oriolmartiribas
- Posts: 26
- Joined: 24 Feb 2010, 17:15
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
When new register is clicked, try updating the dialog contents the using oncomplete event, you can display it empty.
- oriolmartiribas
- Posts: 26
- Joined: 24 Feb 2010, 17:15
Thanks:
<p:commandButton value="New Invoice" actionListener ="#{registerController.newRegister}" oncomplete="dlg.show()" update="dialog"/>
<p:dialog id="dialog" ... widgetVar="dlg" ...>
it works
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).
<p:commandButton value="New Invoice" actionListener ="#{registerController.newRegister}" oncomplete="dlg.show()" update="dialog"/>
<p:dialog id="dialog" ... widgetVar="dlg" ...>
it works
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
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Which PrimeFaces version and browser are you using?
- oriolmartiribas
- Posts: 26
- Joined: 24 Feb 2010, 17:15
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.
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
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Can you double check with the online examples using your browsers?
http://www.primefaces.org:8080/prime-sh ... ogHome.jsf
http://www.primefaces.org:8080/prime-sh ... ogHome.jsf
- oriolmartiribas
- Posts: 26
- Joined: 24 Feb 2010, 17:15
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.
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
- oriolmartiribas
- Posts: 26
- Joined: 24 Feb 2010, 17:15
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?
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
- oriolmartiribas
- Posts: 26
- Joined: 24 Feb 2010, 17:15
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.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?
There is an equivalent component to p:commandButton to work outside a h:form?
PrimeFaces 2.1 RC1 / JSF 2.0 / GlassFish 3 Server
-
- Information
-
Who is online
Users browsing this forum: Google [Bot] and 44 guests