open modal that is in another folder

UI Components for JSF
Post Reply
zorba
Posts: 35
Joined: 29 Jun 2010, 19:52

29 Jun 2010, 20:01

hi there
i got an <p:panel> that look like this

Code: Select all

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<head>
<link type="text/css" rel="stylesheet"
	href="${request.contextPath}/css/dot-luv/skin.css"></link>
</head>
<p:growl id="msgTemplate" />

<p:panel modal="true" closable="true" widgetVar="#{widgetvar}" toggleable="true">
	<f:facet name="header">
		<ui:insert name="headervar" />
	</f:facet>

	<h:form>
		<h:panelGrid columns="4">
			<p:commandButton value="Novo" action="#{managed.novo}" />
			<p:commandButton value="Salvar"	actionListener="#{managed.salvarAction}" />
		</h:panelGrid>

		<ui:insert name="conteudo" />
	</h:form>
</p:panel>
</html>
he is a template for another panels, like this

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/templates/cadastro.xhtml">

		<ui:param name="managed" value="#{managedAluno}" />
		<ui:param name="widgetvar" value="modalAluno" />
		
		<ui:define name="headervar">
			Cadastro de alunos
		</ui:define>
		
		<ui:define name="conteudo">
			<h:panelGrid columns="2">
				<h:outputText value="Nome" />
				<h:inputText value="#{managedAluno.aluno.nome}" />

				<h:outputText value="Data de nascimento" />
				<p:calendar value="#{managedAluno.aluno.dataNascimento}" />

				<h:outputText value="Responsável" />
				<h:inputText value="#{managedAluno.aluno.responsavel}" />

				<h:outputText value="RG" />
				<p:inputMask value="#{managedAluno.aluno.rg}" mask="9.999.999-9" />

				<h:outputText value="CPF" />
				<p:inputMask value="#{managedAluno.aluno.cpf}" mask="999.999.999-99" />

				<h:outputText value="Endereço" />
				<h:inputText value="#{managedAluno.aluno.endereco}" />

				<h:outputText value="Numero" />
				<h:inputText value="#{managedAluno.aluno.numero}" />

				<h:outputText value="Cidade" />
				<h:inputText value="#{managedAluno.aluno.cidade}" />

			</h:panelGrid>
		</ui:define>
</ui:composition>
the first file, is in a folder named 'template', and the second one is in another folder, name 'cadastro'
there is an index page, at the project's root, like this
<h:body>
<h:form>
<p:growl id="msgs"/>
<p:menubar>
<p:submenu label="Cadastros">
<p:menuitem value="Alunos" onclick="modalAluno.show();"></p:menuitem>
<p:menuitem value="Follow-up"></p:menuitem>
</p:submenu>

<p:submenu label="Sair">
<p:menuitem value="Sair" url="/quit"></p:menuitem>
</p:submenu>
</p:menubar>
</h:form>
</h:body>
but the modal doesnt show up :(
should i embbed the panel in my index?
thx and sorry for the english, brazilian here :D

User avatar
boscooo
Posts: 55
Joined: 07 Apr 2010, 15:48
Location: Brazil

30 Jun 2010, 02:06

Hi there!

First of all... when you say panel, you are refering to dialog, ok?
i've tested widgetvar with EL expression... and works ok...
Well... i dont think that the template file is the best place to put your dialog... sounds strange for me... i prefer to create one xhtml for the modal and them include it on pages that will use it.

Try remove p:dialog from template... it should work now.
JBoss Seam 2.2.0 GA Web Framework
Mojarra 1.2_15-SNAPSHOT JSF Implementation
PrimeFaces 1.0.2 Final
RichFaces 3.3.3 Final
JBoss AS 4.2.2 GA

zorba
Posts: 35
Joined: 29 Jun 2010, 19:52

30 Jun 2010, 03:35

ok, i've used p:dialog and used <ui:include> on my index page
works fine now :D
there's no better way to do this? richfaces (sux) loads all modal panels when app starts, and i dont need to include my panels on page
thank you

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 30 guests