Maybe I'm missing something obvious - but a minimizable modal dialog doesn't seem to work as intended for me.
Here's what I have:
<p:dialog ... modal="true" ... minimizable="true" maximizable="true">
...
</p:dialog>
This causes a 'minimize' icon to appear at the top of the dialog, but when I try to minimize the dialog, it gets minimized behind the overlay/modal layer, making the minimized item not accessible, thereby not letting me restore it again!
What attribute am I missing? Or is the minimizable="true" attribute not meant to be used in combination with the modal="true" (I don't see the doc stating that, so just making sure)?
Here's an MCVE:
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<h:title>Minimizable modal demo</h:title>
</h:head>
<h:body>
<h:outputStylesheet library="resources" name="css/theme.css" />
<p:separator />
<p:commandButton value="Show Dialog" onclick="PF('dlg').show();"
type="button" />
<p:dialog header="Dialog" widgetVar="dlg" modal="true"
minimizable="true" maximizable="true">
<h:outputText value="This Dialog can be Maximized an Minimized!" />
</p:dialog>
</h:body>
</html>
Browser: Firefox 37.0
JSF: 2.1.19
PrimeFaces: 5.0
PrimeFacesExtensions: 2.1.0
PrimeFacesTheme: 1.0.8
Related
I have 2 basic templates - one with a side menu, and one without - that both ui:include a common page which contains ui:insert tags (templates are largish, so basic example below).
Using Mojarra everything worked ok, but now I have migrated to MyFaces the ui:insert tags are ignored and the content of the related ui:define does not get rendered (i.e. 'Here are my results' is not displayed).
Should I be specifying included-page.xhtml as a template somehow? I tried
<ui:composition template="included-page.xhtml" />
instead of
<ui:include src="included-page.xhtml" />
but lost the CSS.
Hoping someone can suggest a solution :)
Many thanks,
Neil
my-page.xhtml
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
template="/templates/default-template.xhtml">
<ui:param name="title" value="My Title" />
<ui:define name="results">
Here are my results
</ui:define>
</ui:composition>
default-template.xhtml
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<title>#{title}</title>
</h:head>
<h:body>
<ui:include src="included-page.xhtml" />
</h:body>
</html>
included-page.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:insert name="results">
</ui:insert>
</ui:composition>
The <ui:include> should have been an <ui:decorate>.
<ui:decorate template="included-page.xhtml" />
But if the included-page.xhtml is by itself not reused elsewhere, I wonder why it isn't just been inlined in the master template instead.
See also:
Difference between ui:composition and ui:decorate in Facelets
What is the real conceptual difference between ui:decorate and ui:include?
In the following simple faces page, I am trying to instruct JSF to NOT to validate the input fields.
<?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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:body>
<h:form id="createPatientForm_id">
<p:panelGrid columns="3">
<p:outputLabel value="First Name" />
<p:inputText id="firstNameInput_id" label="First Name" required="true" requiredMessage="First Name is required"/>
<p:message for="firstNameInput_id"/>
</p:panelGrid>
<p:commandButton value="Submit" ajax="false" validateClient="false" />
</h:form>
</h:body>
</html>
When I click on the 'Submit' button, validation does occur. Screen shot below:
I know I have configured required="true". But, shouldn't the validation be skipped as I have also specified validateClient="false"?
What am I missing here?
You need to use immediate="true", perhaps in addition to the Primefaces specific validateClient. Odds are you have disabled client side validation, but not the server side.
I'm trying to use dock menu, but it doesn't work. (it shows the images but it doesn`t zoom on them when I move the mouse over it). I want to use it in the center layout-unit of my page, inserting another page which acctualy contains the dock. The code looks like this:
template.xhtml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<style type="text/css">
body.ui-layout-container { background-color: cadetblue;}
</style>
</h:head>
<h:body>
<p:layout fullPage="true" resizeTitle="resize">
<p:layoutUnit position="north" id="north" resizable="false" size ="75">
<ui:include src="header.xhtml" />
</p:layoutUnit>
<p:layoutUnit position="west" id="west" resizable="false" style="height:580px;overflow:hidden;" size="180">
<ui:include src="menu.xhtml" />
</p:layoutUnit>
<**p:layoutUnit styleClass="layoutUnitCenter" position="center">
!!Here I insert the page which contains the dock
<ui:insert name="content" />
</p:layoutUnit>**
<p:layoutUnit position="south" resizable="true" id="south" size="40">
<ui:include src="footer.xhtml" />
</p:layoutUnit>
</p:layout>
</h:body>
</html>
dock.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
template="template.xhtml">
<ui:define name="content">
<h:head>
</h:head>
<h:body>
<h:form>
<p:dock position="top">
<p:menuitem value="teachers" icon="/images/dock/teacher.png" url="#"/>
<p:menuitem value="students" icon="/images/dock/student.png" url="#"/>
<p:menuitem value="parents" icon="/images/dock/parent.png" url="#"/>
</p:dock>
</h:form>
</h:body>
</ui:define>
</ui:composition>
I tried to use the dock.xhtml by itself, without the ui:composition and it works just fine. But when I try to use it like this, it only shows the images, but doesnt do anything when I move the mouse over the images. Another problem is that it doesnt put the dock in the center of the area. It positions it a little to the left.
I`m pretty new to jsf and Primefaces, so any answer might help.
This code generate the same issue you asked help for:
This little change, solved for me:
I have a h:form with two p:commandButtons. One button is nested inside of ui:repeat inside a component. The button outside of the ui:include seems to navigate properly to the target destination returned by the action method. However the identical button nested inside of ui:include and ui:repeat appears to reinitialize the view scoped bean instead of navigating to the action destination. Does anyone have an explanation and a solution or workaround?
The code is roughly this. mybean is view scoped.
<h:form id="myform">
<p:commandButton value="DoIt" action="#{mybean.doit()}" ajax="true"/> <!-- this works! -->
<ui:include src="/sections/util/mycomp.xhtml">
<ui:param name="backingbean" value="#{mybean}"/>
</ui:include>
</h:form>
Here is the component.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
...
xmlns:p="http://primefaces.org/ui">
<ui:repeat value="#{backingbean.mylit}" var="item" varStatus="status">
<p:commandButton value="DoIt" action="#{backinbean.doit()}" ajax="true"/> <!-- this doesn't -->
</ui:repeat>
</ui:composition>
Strangely if I reposition the nested p:commandButton inside the ui:component but outside of the ui:repeat, then it works.
Any ideas?
Hi I copied your codes and tried to reproduce the problem but it seems that mine is working OK. By the way, if you want to use that button for navigation probably you should set ajax to false. Below are my codes:
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<h:form id="myform">
<p:commandButton value="DoIt" action="#{backingBean.goToAnotherPage()}" ajax="true"/> <!-- this works! -->
<ui:include src="firstpage.xhtml">
<ui:param name="bb" value="#{backingBean}"/>
</ui:include>
</h:form>
</h:body>
</html>
And here the second page firstpage.xhtml:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:repeat value="#{bb.myList}" var="item" varStatus="status">
<p:commandButton value="DoItInRepeat" action="#{bb.goToAnotherPage()}" ajax="true"/> <!-- this doesn't -->
</ui:repeat>
<ui:debug hotkey="x" />
</ui:composition>
And finally the backing bean:
#ManagedBean
#ViewScoped
public class BackingBean {
private List<String> myList = new ArrayList<String>();
#PostConstruct
public void init(){
myList.add("1");
myList.add("2");
myList.add("3");
}
public String goToAnotherPage(){
return "destpage.xhtml";
}
//Getters and Setters
}
I have this issue, i think is a bug, i have a composite component with a simple inputtext, then i try to use my composite component in a modal dialog, at first look all it's ok, you can type inside the inputtext, but when the inputtext lost the focus and try to type again you cant, even you can't erase what you typed before.
In the issue tracker, there are a similiar problem reported:
LINK!!!!!
But this is with autocomplete not with input (maybe can be the same), but is marked as fixed, and i tried with PrimeFaces 3.3.1 and 3.4-SNAPSHOT but the problem persist.
Im using 3.4-SNAPSHOT
Here is a "reproducible test cases", i add an other input to my composite component for lost the focus more easily from first input.
Composite component:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:cc="http://java.sun.com/jsf/composite"
xmlns:p="http://primefaces.org/ui">
<body>
<cc:implementation>
<p:commandButton value="Open dialog composite component" onclick="dialog.show()"/>
<p:dialog widgetVar="dialog">
<p:inputText/>
<p:inputText value="Click here for lost focus of the first input"/>
</p:dialog>
</cc:implementation>
</body>
</ui:composition>
test.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:mycomp="http://java.sun.com/jsf/composite/components"
xmlns:p="http://primefaces.org/ui"
xml:lang="es">
<f:view contentType="text/html">
<h:head>
</h:head>
<h:body>
<h:form id="myform">
<p:commandButton value="Open first dialog" onclick="firstDialog.show()"/>
</h:form>
<h:form id="myform2">
<p:dialog widgetVar="firstDialog" modal="true">
<mycomp:test />
</p:dialog>
</h:form>
</h:body>
</f:view>
</html>
I tried to replace p:inputText with h:inputText and the problem persist.
Im using:
MyFaces 2.1.8, Primefaces 3.4-SNAPSHOT