Hi, I'm using Dialog component with attributes dynamic = "true" and position = "center". The problem is that the left upper corner of dialog
is centered on the screen instead content. It doesn't look good, whole dialog is shifted right and down from the center. When set dynamic = "false", everything works fine. Is it a bug or feature?
Used:
PrimeFacesM4, mojarra 2.1.4, tomcat7
Wrong dialog positioning when dynamic="true"
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
Can you copy/paste your xhtml file here?
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
Here is the test code. Pressing 1st and 3rd button should place the dialog in the same location. But it does not.
This is disadvantage, that makes dialog dynamic loading feature is not as powerfull as it could be.
This is disadvantage, that makes dialog dynamic loading feature is not as powerfull as it could be.
Code: Select all
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head>
<title>Dialog test</title>
</h:head>
<h:body>
<p:commandButton value="Dynamic: false, width not specified" onclick="dyn_false.show()" type="button"/>
<p:commandButton value="Dynamic: true, width specified" onclick="dyn_true_width.show()" type="button"/>
<p:commandButton value="Dynamic: true, width not specified" onclick="dyn_true.show()" type="button"/>
<h:form>
<p:dialog header="Dynamic: false" widgetVar="dyn_false" position="center" dynamic="false">
Lorem ipsum dolor sit amet enim. Etiam ullamcorper.<br/>Suspendisse a pellentesque dui, non felis. <br/>
Maecenas malesuada elit lectus felis, malesuada ultricies.<br/>Curabitur et ligula. Ut molestie a, ultricies porta urna. <br/>
Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis.<br/>
</p:dialog>
<p:dialog header="Dynamic: true, width specified" widgetVar="dyn_true_width" position="center" dynamic="true" width="500">
Lorem ipsum dolor sit amet enim. Etiam ullamcorper.<br/>Suspendisse a pellentesque dui, non felis. <br/>
Maecenas malesuada elit lectus felis, malesuada ultricies.<br/>Curabitur et ligula. Ut molestie a, ultricies porta urna. <br/>
Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis.<br/>
</p:dialog>
<p:dialog header="Dynamic: true, width not specified" widgetVar="dyn_true" position="center" dynamic="true">
Lorem ipsum dolor sit amet enim. Etiam ullamcorper.<br/>Suspendisse a pellentesque dui, non felis. <br/>
Maecenas malesuada elit lectus felis, malesuada ultricies.<br/>Curabitur et ligula. Ut molestie a, ultricies porta urna. <br/>
Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis.<br/>
</p:dialog>
</h:form>
</h:body>
</f:view>
</html>
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
Why don't you add hide() javascript to the buttons as follows (to hide the other dialogs prior to showing the dialog)?
Code: Select all
<p:commandButton value="Dynamic: false, width not specified" onclick="dyn_true_width.hide();dyn_true.hide();dyn_false.show()" type="button"/>
<p:commandButton value="Dynamic: true, width specified" onclick="dyn_true.hide();dyn_false.hide();dyn_true_width.show()" type="button"/>
<p:commandButton value="Dynamic: true, width not specified" onclick="dyn_false.hide();dyn_false.hide();dyn_true.show()" type="button"/>
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
-
- Posts: 6144
- Joined: 10 Sep 2011, 21:10
If you want response from PrimeFaces team, then submit a bug request.
Howard
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
PrimeFaces 6.0, Extensions 6.0.0, Push (Atmosphere 2.4.0)
TomEE+ 1.7.4 (Tomcat 7.0.68), MyFaces Core 2.2.9, JDK8
JUEL 2.2.7 | OmniFaces | EclipseLink-JPA/Derby | Chrome
Java EE 6 Tutorial|NetBeans|Google|Stackoverflow|PrimeFaces|Apache
Hi pitupitu,
I have the same problem. I must enable lazy loading for my dialogs with "dynamic"-attribute, but dialogs will not be centered.
@PrimeFaces Team: Should I open an issue for that?
Greets Rüdiger
I have the same problem. I must enable lazy loading for my dialogs with "dynamic"-attribute, but dialogs will not be centered.
@PrimeFaces Team: Should I open an issue for that?
Greets Rüdiger
Rüdiger
PrimeFaces 11.0 | Ultima 2.0
Mojarra 2.3 | Tomcat 8/9 | Win7/10 | OS X 10.14
PrimeFaces 11.0 | Ultima 2.0
Mojarra 2.3 | Tomcat 8/9 | Win7/10 | OS X 10.14
Try with giving startup dimensions;
Then, we'll discuss into this issue while 3.0RC labs.
Code: Select all
<p:dialog width="300" height="300" >
...
PrimeFaces Team Member
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Reason is, initial position is calculated on load, for lazy dialogs this causes a problem since position is calculated without knowing the dialog content size. Feel free to create an issue ticket as an enhancement.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 12 guests