I am implementing the vertical toggle panel but it is not getting toggled after the click on + icon, I have pasted entire code.
Code: Below is entire code:
find this comment in the Technical Sheet section
<?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: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>
<title>Projects Details</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<h:outputScript library="js" name="ppcr.js"></h:outputScript>
<h:outputStylesheet library="css" name="ppcr.css"/>
<h:outputStylesheet library="css" name="styles.css"/>
<script type="text/javascript" language="JavaScript">
$(document).ready(function() {
$('.subMenu').smint({
'scrollSpeed' : 1000
});
});
</script>
</h:head>
<h:body onload="setTimeout(function() { window.scrollTo(0, 1) }, 100);">
<div class="header">
<h:graphicImage style="vertical-align: middle" value="resources/images/logoMainShort.gif" />
<b style="vertical-align: top;"> Quotation Tool</b>
</div>
<div style="line-height: 25px;margin: 0px 6px 0px 6px;">
<h:form>
<div class="navigation">
<h:outputLink value="projects.xhtml">
<h:outputText value="PROJECTS" style="color: #ffffff; text-decoration: none;"></h:outputText>
</h:outputLink>
<h:outputLink value="masterData.xhtml">
<b style="padding-left: 20px;">
<h:outputText
value="MASTER DATA"
style="color: #ffffff; text-decoration: none;">
</h:outputText>
</b>
</h:outputLink>
</div>
</h:form>
</div>
<div class= "background">
<div class="test" style="padding-top: 10px">Ford_V408_2015_PPCR01</div>
<!-- <div class="wrap"> -->
<div class="subMenu" style="margin-left: 1px">
List To Quote
</div>
<div class="subMenu" style="margin-left: 22%">
AVO
</div>
<div class="subMenu" style="margin-left: 43.8%">
Technical Sheet
</div>
<div class="subMenu" style="margin-left: 65%">
Geometry
</div>
<h:form id="testForm">
<div class="innersection">
<div class="section s5">
<div class="heading">
<h:outputText value="Project information" />
</div>
<p:panelGrid
style="margin:5px 0px 15px 0px;
width:100%"
styleClass="panelgrid">
<p:row>
<p:column colspan="8" />
</p:row>
<p:row>
<p:column style="border:white" styleClass="columnA">Brand Group</p:column>
<p:column styleClass="columnB">
<h:outputText value="Ford" />
</p:column>
<p:column styleClass="columnA">Model (Car Name) </p:column>
<p:column styleClass="columnB">
<h:outputText value="Ford Mondeo" />
</p:column>
<p:column styleClass="columnA">Annual Model Volume </p:column>
<p:column styleClass="columnB">
<h:outputText value="25 000" />
</p:column>
<p:column styleClass="columnA">Lifetime</p:column>
<p:column styleClass="columnB">
<h:outputText value="3 years" />
</p:column>
</p:row>
<p:row>
<p:column styleClass="columnA">Brand</p:column>
<p:column styleClass="columnB">
<h:outputText value="Ford" />
</p:column>
<p:column styleClass="columnA">Project Code</p:column>
<p:column>
<h:commandLink value="FORD_V408_2015" action="/projectDetails.xhtml" target="_blank"
style="cursor:pointer;font-style: normal; font-family: Arial;color:#0000ff;font-size:13px;text-decoration: underline;"/>
</p:column>
<p:column styleClass="columnA">Reason to quote</p:column>
<p:column styleClass="columnB">
<h:outputText value="New Car" />
</p:column>
<p:column styleClass="columnA">Peak Volume</p:column>
<p:column styleClass="columnB">
<h:outputText value="25 000" />
</p:column>
</p:row>
<p:row>
<p:column colspan="8" />
</p:row>
</p:panelGrid>
<div class="heading">
<h:outputText value="PPCR general information" />
</div>
<p:panelGrid
id="addText"
style="margin:5px 0px 15px 0px; width:100%"
styleClass="panelgrid">
<p:row>
<p:column colspan="8" />
</p:row>
<p:row>
<p:column styleClass="columnA">Part Type</p:column>
<p:column styleClass="columnB">
<h:outputText value="WS" />
</p:column>
<p:column styleClass="columnA">PPCR Date</p:column>
<p:column styleClass="columnB">
<h:outputText value="25/10/2013" />
</p:column>
<p:column styleClass="columnA" style="width:14%;">Development Step</p:column>
<p:column styleClass="columnB">
<h:selectOneMenu value="#{ppcrGeneral.selectedStepsValue}" style="width:280px;" >
<f:selectItems value="#{ppcrGeneral.stepsValue}" />
</h:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column styleClass="columnA">Family</p:column>
<p:column styleClass="columnB">
<h:outputText value="Laminated " />
</p:column>
<p:column styleClass="columnA">Reply Date</p:column>
<p:column styleClass="columnB">
<h:inputText value="04/11/2013" />
</p:column>
<p:column styleClass="columnA">Reason for<br/> update</p:column>
<p:column rowspan="3" styleClass="columnB">
<p:inputTextarea rows="6" cols="42" autoResize="false" />
</p:column>
</p:row>
<p:row>
<p:column styleClass="columnA">Market</p:column>
<p:column styleClass="columnB">
<h:selectOneMenu value="#{ppcrGeneral.selectedMarketValue}" style="width:140px;" >
<f:selectItems value="#{ppcrGeneral.marketValue}" />
</h:selectOneMenu>
</p:column>
<p:column styleClass="columnA" style="width:14%;">Reference PPCR</p:column>
<p:column styleClass="columnB">
<h:inputText size="16"/>
</p:column>
<p:column/>
</p:row>
<p:row>
<p:column
style="font-style: normal; font-family:Arial;font-size: 13px; font-weight: bold;width:15%;color: #333333;
text-align: right;">
Document Hyperlink
</p:column>
<p:column colspan="3">
<h:inputText size="51"/>
<p:commandLink>
<p:graphicImage
style="vertical-align: middle; margin-left: 5px;position: middle;border: none; WIDTH:15px; HEIGHT:15px;"
value="resources/images/attach.png"/>
</p:commandLink>
</p:column>
<p:column/>
</p:row>
<p:row>
<p:column colspan="4"/>
<p:column styleClass="columnA" style="vertical-align:top;">Industrialization Manager</p:column>
<p:column styleClass="columnB" style="width:15%" >
<ui:repeat var="input" value="#{bean.inputTexts}">
<p:inputText size="18" value="#{inputTexts}" style="margin-bottom:2px;"/>
</ui:repeat>
<b style="padding:0px 0px 0px 18px">
<p:commandButton
value="Add Manager"
actionListener="#{bean.addInput}"
update="addText"
style=" margin-bottom:10px;width:auto;height:28px;font-style: normal; font-family:Arial;font-size: 13px;
color: #000000;text-align:center;font-weight: normal;text-decoration:none;cursor: pointer "/>
</b>
</p:column>
</p:row>
<p:row>
<p:column colspan="8" />
</p:row>
</p:panelGrid>
<div class="heading">
<h:outputText value="Packaging" />
</div>
<p:panelGrid
styleClass="panelgrid"
style="margin:5px 0px 15px 0px; width:100%;" >
<p:row>
<p:column colspan="8" />
</p:row>
<p:row>
<p:column styleClass="columnC" style="width:25%">Customer Packaging
<p:selectBooleanCheckbox style="position:absolute; margin-left:10px;"></p:selectBooleanCheckbox>
</p:column>
<p:column styleClass="columnC" style="width:25%">AGC Container
<p:selectBooleanCheckbox style="position:absolute; margin-left:10px;"></p:selectBooleanCheckbox>
</p:column>
<p:column styleClass="columnC" style="width:25%">OEM
<p:selectBooleanCheckbox style="position:absolute; margin-left:10px;"></p:selectBooleanCheckbox>
</p:column>
<p:column styleClass="columnC" style="width:25%; text-align:center;">ARG
<p:selectBooleanCheckbox style="position:absolute; margin-left:10px;"></p:selectBooleanCheckbox>
</p:column>
</p:row>
<p:row>
<p:column colspan="8" />
</p:row>
</p:panelGrid>
<div class="heading">
<h:outputText value="Logistics" />
</div>
<p:panelGrid
id="logistics"
styleClass="panelgrid"
style="margin:5px 0px 15px 0px; width:100%;" >
<p:row>
<p:column colspan="6" />
</p:row>
<p:row>
<p:column styleClass="columnA" style="width:15%;vertical-align:top;">Shipping location </p:column>
<p:column styleClass="columnB" >
<ui:repeat var="input" value="#{bean.inputLocation}">
<p:inputText value="#{inputLocation}" style="margin-bottom:2px;"/>
</ui:repeat>
<p:commandButton
value="Add Location"
actionListener="#{bean.addLocation}"
update="logistics"
style=" margin-bottom:10px;width:auto;height:28px;font-style: normal; font-family:Arial;
font-size: 13px;color: #000000;text-align:center;font-weight: normal;text-decoration:none;cursor: pointer "/>
</p:column>
<p:column styleClass="columnA" style="width:15%; vertical-align:top; ">Incoterm </p:column>
<p:column styleClass="columnB">
<ui:repeat var="input" value="#{bean.inputIncoterm}">
<h:selectOneMenu value="#{ppcrGeneral.selectedIncotermValue}" style="width:140px;margin-bottom:6px" >
<f:selectItems value="#{ppcrGeneral.incotermValue}" />
</h:selectOneMenu>
</ui:repeat>
<!-- <b style="margin: 0px 30px 20px 0px;"> -->
<p:commandButton
value="Add Incoterm"
actionListener="#{bean.addIncoterm}"
update="logistics"
style=" margin-bottom:10px;width:auto;height:28px;font-style: normal; font-family:Arial;font-size: 13px;
color: #000000;text-align:center;font-weight: normal;text-decoration:none;cursor: pointer "/>
<!-- </b> -->
</p:column>
<p:column styleClass="columnA" style="width:15% ;vertical-align:top;" >Just in sequence </p:column>
<p:column styleClass="columnB" style="width:20%;vertical-align:top;">
<h:selectOneMenu value="#{ppcrGeneral.selectedSequenceValue}" style="width:100px;" >
<f:selectItems value="#{ppcrGeneral.sequenceValue}" />
</h:selectOneMenu>
<h:outputText
value="per day"
style="margin-left:5px;font-style: normal; font-family:Arial; FONT-WEIGHT: bold;color:#999999;font-size: 13px;"/>
</p:column>
</p:row>
<p:row>
<p:column colspan="8" />
</p:row>
</p:panelGrid>
</div>
<div class="section s1">
Removed code fron this section
</div>
<div class="section s2">
<h1>AVO</h1>
</div>
<!-- PPCR: Technical Section -->
<div class="section s3">
<div class="heading">
<h:outputText value="Technical Sheet" />
</div>
<div class="border">
<p:panelGrid style="margin:5px 0px 15px 0px; width:100%"
styleClass="panelgrid">
<p:row>
<p:column colspan="2"/>
</p:row>
<p:row>
<p:column styleClass="columnB" style="width:30%">
<h:commandLink action="/pdfFileUpload.xhtml" target="options:height=200, width=300">
<p:graphicImage value="resources/images/upload.png"
style="vertical-align: middle; position: middle;border: none;"/>
</h:commandLink>
</p:column>
<!-- Panel is not working -->
<p:column rowspan="11" style="vertical-align:top">
<p:panel header="Size" toggleable="true" rendered="true"
toggleOrientation="vertical">
<h:outputText value="Test" />
</p:panel>
</p:column>
<!-- Panel is not working -->
</p:row>
<p:row>
<p:column />
</p:row>
<p:row>
<p:column />
</p:row>
<p:row>
<p:column>
<h:outputText
value="Manufacuring Control Method"
style="color:#164990;font-size:13px;font-family:Arial;font-style: normal;font-weight: bold;" />
</p:column>
</p:row>
<p:row>
<p:column >
<h:outputText value="Check fixt. position" styleClass="columnD"/>
<h:selectOneMenu
value="#{ppcrGeneral.selectedMarketValue}"
style="width:200px;font-style: normal;font-family: Arial;FONT-WEIGHT: 400;font-size: 13px;text-align: left;color: #333333;
margin-left: 15px;" >
<f:selectItems value="#{ppcrGeneral.marketValue}" />
</h:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column >
<h:outputText value="Check fixt. concept" styleClass="columnD"/>
<h:selectOneMenu
value="#{ppcrGeneral.selectedMarketValue}"
style="width:200px;font-style: normal;font-family: Arial;FONT-WEIGHT: 400;font-size: 13px;text-align: left;color: #333333;
margin-left: 15px;" >
<f:selectItems value="#{ppcrGeneral.marketValue}" />
</h:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column >
<h:outputText value="Spacers" styleClass="columnD" style="margin-left:21%"/>
<h:selectOneMenu
value="#{ppcrGeneral.selectedMarketValue}"
style="width:200px;font-style: normal;font-family: Arial;FONT-WEIGHT: 400;font-size: 13px;text-align: left;color: #333333;
margin-left: 15px;" >
<f:selectItems value="#{ppcrGeneral.marketValue}" />
</h:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column >
<h:outputText value="Stoppers" styleClass="columnD" style="margin-left:20%"/>
<h:selectOneMenu
value="#{ppcrGeneral.selectedMarketValue}"
style="width:200px;font-style: normal;font-family: Arial;FONT-WEIGHT: 400;font-size: 13px;text-align: left;color: #333333;
margin-left: 15px;" >
<f:selectItems value="#{ppcrGeneral.marketValue}" />
</h:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column colspan="2"/>
</p:row>
<p:row>
<p:column colspan="2"/>
</p:row>
</p:panelGrid>
</div>
</div>
<!-- PPCR: Technical Section Ends -->
<div class="section s4">
<h1>Geometry</h1>
<br class="clear"></br>
</div>
</div>
<script type="text/javascript" language="javascript">
var _gaq = _gaq || [];
_gaq.push([ '_setAccount', 'UA-9804757-1' ]);
_gaq.push([ '_trackPageview' ]);
(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl'
: 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
</h:form>
</div>
</h:body>
</html>
probably that's because of jquery ,if you include jquery in your page many of primefaces components doesn't work correctly,
replace
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
with :
<h:outputScript library="primefaces" name="jquery/jquery.js" />
Related
I am building an application where it is necessary to register a user, more precisely a picture for a user besides his name, username and some other information, when the registration window is show, a default user image is load, then when they select a new image the default image dissapear and the selected one is displayed on the window, and a new button is displayed as well, this button allows the user to remove the selected picture, so the default image must be display again, but I still can't display again the default picture in case de button is clicked to return to the default picture and remove the selected one
View where users are listed and the modal window is displayed
<?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:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui">
<ui:composition template="/sesionAdmin/_admintmp.xhtml">
<ui:define name="body">
<h:head>
<h:outputScript library="js" name ="Calendario.js"/>
</h:head>
<h:body>
<h:form>
<p:commandButton id="createButton" value="Registrar usuario"
onclick="PF('UsuarioCreateDialog').show()">
</p:commandButton>
</h:form>
<p:separator/>
<h:form id="UsuarioListForm">
<p:panelGrid columns="2" styleClass="panelgrid">
<p:outputLabel style="font-weight: bold;" value="Buscar usuario:" />
<p:inputText placeholder="Digite nombres, apellidos, nombre de usuario o email"
style="width: 350px;" value="#{usuarioController.datoBusqueda}" >
<p:ajax event="keyup" update="datalist" listener="#{usuarioController.buscarUsuario()}" />
</p:inputText>
</p:panelGrid>
<p:dataTable id="datalist" value="#{usuarioController.items}" var="item"
paginator="true" widgetVar="tablaUsuarios"
rows="10"
rowsPerPageTemplate="10,20"
>
<f:facet name="header">
</f:facet>
<p:column >
<f:facet name="header">
<h:outputText value="Nombres"/>
</f:facet>
<h:outputText value="#{item.usunombres}"/>
</p:column>
<p:column >
<f:facet name="header">
<h:outputText value="Apellidos"/>
</f:facet>
<h:outputText value="#{item.usuapellidos}"/>
</p:column>
<p:column >
<f:facet name="header">
<h:outputText value="Nombre de usuario"/>
</f:facet>
<h:outputText value="#{item.usunombreusuario}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Email"/>
</f:facet>
<h:outputText value="#{item.usuemail}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Cargo"/>
</f:facet>
<h:outputText value="#{item.carid.carnombre}"/>
</p:column>
<p:column width="70" style="text-align: center">
<f:facet name="header">
<h:outputText value="Foto" />
</f:facet>
<p:graphicImage id="imgUsuario" value="#{usuarioController.imagenFlujo}" width="50" height="50" >
<f:param name="id" value="#{item.usuid}" />
</p:graphicImage>
</p:column>
<p:column style="width: 90px">
<f:facet name="header">
<p:outputLabel value="Acciones"/>
</f:facet>
<p:commandButton id="viewButton" icon="ui-icon-search" action="#{usuarioController.seleccionarUsuarioVer(item)}" update=":UsuarioViewForm, :formfotoView" oncomplete="PF('UsuarioViewDialog').show()" />
<p:commandButton id="editButton" icon="ui-icon-pencil" action="#{usuarioController.seleccionarUsuarioEditar(item)}" update=":UsuarioEditForm, :formEditarfoto" oncomplete="PF('UsuarioEditDialog').show()" />
</p:column>
</p:dataTable>
</h:form>
<ui:include src="RegistrarUsuario.xhtml"/>
<ui:include src="EditarUsuario.xhtml"/>
<ui:include src="VerInfoUsuario.xhtml"/>
<p:dialog header="Información" modal="true" position="center" widgetVar="mensajeRegistroExitoso" closable="false">
<p:messages style="font-size: 15px;" showDetail="true" autoUpdate="true"/>
<h:form>
<p:commandButton value="Aceptar" style="font-weight: normal;"
onclick="PF('mensajeRegistroExitoso').hide()"/>
</h:form>
</p:dialog>
</h:body>
</ui:define>
</ui:composition>
</html>
User dialog window
<?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://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<ui:composition>
<p:dialog id="UsuarioCreateDlg" widgetVar="UsuarioCreateDialog" modal="true" resizable="false"
appendTo="#(body)" header="Registrar usuario">
<h:outputStylesheet name="css/appearUploadFile.css" />
<p:ajax event="close" listener="#{usuarioController.cancelarRegistroUsuario()}"/>
<p:outputLabel style="float: right;" value=" Campos obligatorios" />
<p:outputLabel style="float: right; font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
<br/>
<!--h:form id="formfoto" enctype="multipart/form-data"-->
<center>
<p:outputLabel style="font-weight:bold;" value="Foto de perfil" />
</center>
<center>
<br/>
<p:graphicImage rendered="#{usuarioController.miImagen ==null}"
style="height:100px; width:100px;"
value="#{usuarioController.imagenDefecto}"/>
<p:graphicImage rendered="#{usuarioController.miImagen !=null}"
id="img"
style="height:100px; width:100px;"
value="#{usuarioController.miImagen}"
cache="false"/>
<p:fileUpload mode="advanced" auto="true" fileUploadListener="#{usuarioController.convertirImagenABytes}"
allowTypes="/(\.|\/)(jpe?g|png)$/" sizeLimit="10000000" invalidFileMessage="El archivo no está en el formato válido"
required="true"
update="#form" multiple="false" label="Subir imagen">
</p:fileUpload>
<h:commandLink rendered="#{usuarioController.miImagen !=null}"
value="Imagen por defecto"
actionListener="#{usuarioController.establecerFotoPorDefecto()}"
>
<f:ajax execute="#all" render="#form"/>
<p:ajax update="UsuarioCreateDlg"/>
</h:commandLink>
</center>
<br/>
<!--/h:form-->
<h:form id="UsuarioCreateForm">
<p:panelGrid styleClass="panelgrid" id="panel2">
<p:row>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Nombres:" />
<p:outputLabel style="font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
</p:column>
<p:column>
<p:inputText id="usunombres" value="#{usuarioController.selected.usunombres}"
title="#{bundleAdmin.CreateUsuarioTitle_usunombres}" required="true"
requiredMessage="Campo obligatorio">
<f:validator validatorId="ValidarCampo75Caracteres"/>
<p:ajax event="keyup" update="msgCaracteresNombre"/>
</p:inputText>
</p:column>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Apellidos:" />
<p:outputLabel style="font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
</p:column>
<p:column>
<p:inputText id="usuapellidos" value="#{usuarioController.selected.usuapellidos}"
title="#{bundleAdmin.CreateUsuarioTitle_usuapellidos}" required="true"
requiredMessage="Campo obligatorio">
<f:validator validatorId="ValidarCampo75Caracteres"/>
<p:ajax event="keyup" update="msgCaracteresApellido"/>
</p:inputText>
</p:column>
</p:row>
<p:row>
<p:column>
</p:column>
<p:column>
<p:message id="msgCaracteresNombre" for="usunombres"/>
</p:column>
<p:column>
</p:column>
<p:column>
<p:message id="msgCaracteresApellido" for="usuapellidos"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Genero:" />
</p:column>
<p:column>
<p:selectOneRadio value="#{usuarioController.selected.usugenero}">
<f:selectItem itemLabel="Masculino" itemValue="M" />
<f:selectItem itemLabel="Femenino" itemValue="F" />
</p:selectOneRadio>
</p:column>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Fecha de nacimiento:" />
<p:outputLabel style="font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
</p:column>
<p:column>
<p:calendar id="usufechanacimiento"
placeholder="dd/mm/aaaa" pattern="dd/MM/yyyy"
value="#{usuarioController.selected.usufechanacimiento}"
title="#{bundleAdmin.EditUsuarioTitle_usufechanacimiento}"
required="true"
readonlyInput="true"
requiredMessage="Campo obligatorio"
showOn="button"
navigator = "true"
locale="es"
maxdate="#{usuarioController.fechaHoy}">
<p:ajax event="keyup" update="msgUsuFechaNacimiento"/>
<p:ajax event="dateSelect" update="msgUsuFechaNacimiento"/> </p:calendar>
</p:column>
</p:row>
<p:row>
<p:column>
</p:column>
<p:column>
</p:column>
<p:column>
</p:column>
<p:column>
<p:message id="msgUsuFechaNacimiento" for="usufechanacimiento"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Email:" />
<p:outputLabel style="font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
</p:column>
<p:column>
<p:inputText id="usuemail" value="#{usuarioController.selected.usuemail}"
title="#{bundleAdmin.CreateUsuarioTitle_usuemail}"
required="true" requiredMessage="Campo obligatorio">
<f:validator validatorId="ValidarCampoCorreoElectronico"/>
<p:ajax event="keyup" update="msgCaracteresEMail"/>
</p:inputText>
</p:column>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Cargo:" />
</p:column>
<p:column>
<p:selectOneMenu id="carid" value="#{usuarioController.cargo}" >
<f:selectItems value="#{cargoController.itemsAvailableSelectOne}"
var="caridItem"
itemValue="#{caridItem}"
itemLabel="#{caridItem.carnombre}"
/>
<f:validator validatorId="ValidarCamposSeleccionar"/>
</p:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column>
</p:column>
<p:column>
<p:message id="msgCaracteresEMail" for="usuemail"/>
</p:column>
<p:column>
</p:column>
<p:column>
<p:message for="carid"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Tipo de usuario:" />
</p:column>
<p:column>
<p:selectOneMenu id="grupoId" value="#{usuarioController.grupo.gruid}" >
<p:ajax event="change" update="grupoId"/>
<f:selectItems value="#{grupoController.itemsAvailableSelectOne}"
var="grupo"
itemValue="#{grupo.gruid}"
itemLabel="#{grupo.grudescripcion}"
>
</f:selectItems>
<f:validator validatorId="ValidarCamposSeleccionar"/>
</p:selectOneMenu>
</p:column>
</p:row>
<p:row>
<p:column>
</p:column>
<p:column>
<p:message for="grupoId"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Nombre de usuario:" />
<p:outputLabel style="font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
</p:column>
<p:column>
<p:inputText id="usunombreusuario" value="#{usuarioController.selected.usunombreusuario}"
title="#{bundleAdmin.CreateUsuarioTitle_usunombreusuario}" required="true"
requiredMessage="Campo obligatorio">
<f:validator validatorId="ValidarCampoNombreUsuario"/>
<p:ajax event="keyup" update="msgCaracteresNombreUsuario"/>
</p:inputText>
</p:column>
<p:column>
<p:outputLabel style="font-weight:bold;" value="Contraseña:" />
<p:outputLabel style="font-style: italic; font-size: 16px; text-align: left; color: red;" value="* " />
</p:column>
<p:column>
<p:password id="usucontrasena" value="#{usuarioController.selected.usucontrasena}"
title="#{bundleAdmin.CreateUsuarioTitle_usucontrasena}"
required="true" requiredMessage="Campo obligatorio"/>
</p:column>
</p:row>
<p:row>
<p:column>
</p:column>
<p:column>
<p:message id="msgCaracteresNombreUsuario" for="usunombreusuario"/>
</p:column>
<p:column>
</p:column>
<p:column>
<p:message for="usucontrasena"/>
</p:column>
</p:row>
</p:panelGrid>
<p:separator/>
<center>
<p:commandButton action="#{usuarioController.registrarUsuario()}"
value="Registrar" update=":UsuarioListForm:datalist, panel2"
/>
</center>
</h:form>
</p:dialog>
</ui:composition>
</html>
User controller
public class UsuarioController implements Serializable {
#EJB
private com.unicauca.coordinacionpis.sessionbean.UsuarioFacade ejbUsuario;
#EJB
private UsuariogrupoFacade ejbUsuarioGrupo;
private List<Usuario> items = null;
private Cargo cargo;
private Grupo grupo;
private List<Usuario> filtroBusqueda;
private boolean campoFoto;
private boolean campoContrasena;
private String contrasena;
private String datoBusqueda;
private Usuario usuario;
private UploadedFile file;
private SimpleDateFormat formatoFecha;
private byte[] imagen;
private DefaultStreamedContent miImagen;
private UploadedFile uploadedFile;
public StreamedContent getImagenDefecto(){
return Utilidades.getImagenPorDefecto("foto");
}
public StreamedContent getImagen(Usuario usuario) {
RequestContext requestContext = RequestContext.getCurrentInstance();
FacesContext context = FacesContext.getCurrentInstance();
String id = context.getExternalContext().getRequestParameterMap().get("idUsu");
if (usuario.getUsufoto() == null) {
return Utilidades.getImagenPorDefecto("foto");
} else {
return new DefaultStreamedContent(new ByteArrayInputStream(usuario.getUsufoto()));
}
}
public void establecerFotoPorDefecto()
{
System.out.println("Hallo");
this.miImagen = null;
RequestContext requestContext = RequestContext.getCurrentInstance();
//requestContext.execute("PF('UsuarioCreateDialog').hide()");
//requestContext.execute("PF('UsuarioCreateDialog').show()");
//this.imagenPorDefecto();
}
public DefaultStreamedContent getMiImagen() {
convertirBytesAImagen();
/*if(miImagen==null)
miImagen = Utilidades.getImagenPorDefecto("foto");*/
return miImagen;
}
public void convertirBytesAImagen()
{
if(imagen != null)
{
InputStream is = new ByteArrayInputStream((byte[]) imagen);
miImagen = new DefaultStreamedContent(is, "image/png");
}
}
}
The method I am calling to set the default picture is establecerFotoPorDefecto()
I´ve a couple issues with a page I´m working on.
I have two sections: frmConf and frmData.
The first one has some parameters I use for searching purposes.
The second one has a DataTable defined as lazy and algo I have it´s corresponding backing wich extends LazyDatamodel.
In the mentioned DataTable in section 2 I have a column with a commandLink which creates a PDF document for the selected row in the DataTable.
The problem I´m facing is it works just fine the first time I load the page:
It calls the load (#override) method from LazyDatamodel and presents the first 10 records of the query results from the DB.
Then, when I click on the commandLink column it shows the "save as" dialog for the corresponding PDF just fine and I can proceed to download the file.
But then, for some reason wich I don´t yet understand, if I click another row´s PDF commandLink it goes and calls the referred load method a requeries the DB assuming I´m trying to do some pagination and it doesn´t even generate the required PDF.
What I´m trying to achieve is just load the page for every pagination case and not for any unrelated event like clicking the PDF button for the selected row.
Why is it reloading and requerying (even though it shows the same results as the indexes for pagination haven´t change) the entire page content after the first (correct)PDF generation?
It´s my guess something happens after the first PDF generation (it leaves the page with some "reload required" state.
I´m leaving the markup from the page as well as the corresponding backing bean PDF generation method.
Please I´d really appreciate if someone could help me with this.
Thanks!
JSF markup:
<!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">
<ui:composition template="/templates/cimaTemplate.xhtml">
<ui:define name="tituloPagina">
<h:outputText value="Consulta Documentos" />
</ui:define>
<ui:define name="tituloFormulario">
<h:outputText value="Documentos" styleClass="titulo" />
</ui:define>
<ui:define name="contenido">
<style>
.style1 {
text-align: right;
}
.style3 {
text-align: left;
}
.style2 {
text-align: center;
background: blue;
color: white;
font-weight: bold;
}
.colEstadoStyle {
td:nth-child(1)
width: 20px;
}
.imageClass {
display: block;
background-image: url('/imagenes/pdf.png') no-repeat 100%;
}
</style>
<h:form id="frmConf" styleClass="form" >
<p:growl id="growl" showDetail="true" sticky="true" />
<p:panel id="datosEmisorPanel">
<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
<p:panelGrid style="margin: 0 auto;" id="panelG">
<p:row>
<p:column>
<p:panelGrid>
<p:row>
<p:column style="text-align: center;" colspan="2">
<strong><h:outputLabel styleClass="label" value="Seleccionar Archivo" /></strong>
<p:selectManyCheckbox style="text-align: center;"
value="#{cabDocumentoMB.selectedOptionsEmail}">
<f:selectItem itemValue="PDF" itemLabel="PDF" />
<f:selectItem itemValue="XML" itemLabel="XML" />
</p:selectManyCheckbox>
</p:column>
</p:row> <p:row>
<p:column colspan="2">
<strong><h:outputLabel styleClass="label"
value="E-Mails" /></strong>
<br></br>
<h:inputTextarea value="#{cabDocumentoMB.correos}"
cols="40" />
<br></br>
</p:column>
</p:row> <p:row>
<p:column colspan="2">
<strong><h:outputLabel styleClass="style1"
value="Formato: email1#email.com,email2#email.com" /></strong>
</p:column>
</p:row> <p:row>
<p:column rowspan="2">
<p:commandButton icon="ui-icon-mail-closed"
value=" Envio normal" id="bto_enviarEmail"
oncomplete="bloquearPagina.hide()"
onstart="bloquearPagina.show()"
action="#{cabDocumentoMB.EnviarCorreos('Normal')}"
update="growl">
</p:commandButton>
<p:blockUI block="frmConf" widgetVar="bloquearPagina">
Enviando correo...<br />
<p:graphicImage value="/imagenes/ajax-loader.gif" />
</p:blockUI>
<p:blockUI block="frmConf" widgetVar="bloquearReproceso">
Reprocesando...<br />
<p:graphicImage value="/imagenes/ajax-loader.gif" />
</p:blockUI>
</p:column>
<p:column rowspan="2">
<p:commandButton value=" Envio ZIP" icon="ui-icon-tag"
action="#{cabDocumentoMB.EnviarCorreos('ZIP')}"
oncomplete="bloquearPagina.hide()"
onstart="bloquearPagina.show()" update="growl">
</p:commandButton>
<br />
</p:column>
</p:row> </p:panelGrid>
</p:column>
<p:column colspan="0">
<p:panelGrid> <p:row>
<p:column colspan="1" styleClass="style1">
<strong><h:outputLabel styleClass="label" size="30"
value="Cédula/RUC/Pasaporte" /></strong>
</p:column>
<p:column colspan="1" styleClass="style3">
<h:inputText styleClass="text" style="font-weight: bold;"
value="#{cabDocumentoMB.ruc}" />
</p:column>
</p:row> <p:row>
<p:column colspan="1" styleClass="style1">
<strong><h:outputLabel styleClass="label" size="30"
value="Nombres:" /></strong>
</p:column>
<p:column colspan="1" styleClass="style3">
<h:inputText styleClass="text" style="font-weight: bold;"
value="#{cabDocumentoMB.razonSocial}" />
</p:column>
</p:row> <p:row>
<p:column styleClass="style1">
<strong><h:outputLabel styleClass="label"
value="Número del Documento:" /></strong>
</p:column>
<p:column styleClass="style3">
<h:inputText value="#{cabDocumentoMB.numDocumento}"
size="30" title="Número del Documento" placeHolder="TBD"/>
</p:column>
</p:row> <p:row>
<p:column styleClass="style1">
<strong><h:outputLabel styleClass="label"
value="Tipo de Documento:" /></strong>
</p:column>
<p:column styleClass="style3">
<p:selectOneMenu
value="#{cabDocumentoMB.seleccionTipo}">
<f:selectItems value="#{cabDocumentoMB.tipo}" />
</p:selectOneMenu>
</p:column>
</p:row> <p:row>
<p:column styleClass="style1">
<strong><h:outputLabel styleClass="label"
value="Estados:" /></strong>
</p:column>
<p:column styleClass="style3">
<p:selectOneMenu
value="#{cabDocumentoMB.seleccionTipoEstado}">
<f:selectItems value="#{cabDocumentoMB.tipoEstados}" />
</p:selectOneMenu>
</p:column>
</p:row> <p:row>
<p:column>
<strong><h:outputLabel styleClass="label"
value="Fecha Inicial:" /></strong>
<br></br>
<p:calendar id="txt_inicial"
value="#{cabDocumentoMB.fechaInicio}"
pattern="yyyy-MM-dd" mask="true" mode="popup" showOn="button"
readonlyInput="true">
<f:convertDateTime type="date" dateStyle="short"
pattern="yyyy-MM-dd" />
</p:calendar>
</p:column>
<p:column>
<strong><h:outputLabel styleClass="label"
value="Fecha Final:" /></strong>
<br></br>
<p:calendar id="txt_final"
value="#{cabDocumentoMB.fechaFinal}"
pattern="yyyy-MM-dd" mask="true" mode="popup" showOn="button"
readonlyInput="true">
<f:convertDateTime type="date" dateStyle="short"
pattern="yyyy-MM-dd" />
</p:calendar>
</p:column>
</p:row> <p:row>
<p:column style="text-align: center;">
<p:commandButton value=" Busqueda " icon="ui-icon-search"
title="Buscar Filtrado"
action="#{cabDocumentoMB.findDocumentos()}"
update=":frmData:listaDocumentos,:frmConf:datosEmisorPanel">
</p:commandButton>
</p:column>
<p:column>
<p:commandButton value="Reprocesar documentos "
icon="ui-icon-tag"
action="#{CabDocumentoMB.reprocesarDocumentos()}"
disabled="#{CabDocumentoMB.botonReprocesarActivo}"
update=":frmData:listaDocumentos,:frmConf:datosEmisorPanel">
</p:commandButton>
<br />
</p:column>
</p:row> </p:panelGrid>
</p:column>
</p:row>
</p:panelGrid>
</p:panel>
</h:form>
<h:form id="frmData" styleClass="form">
<p:panel id="datosDetalle22" >
<h:panelGroup id="listaDocumentos">
<p:dataTable id="lazyDataTable"
var="documento"
value="#{cabDocumentoMB.allDocumentos}"
paginator="true" rows="10" rowsPerPageTemplate="10,50,100"
selection="#{cabDocumentoMB.seleccionDocu}"
update=":frmData:listaDocumentos"
lazy="true">
<f:facet name="header">
Consulta de Documentos
</f:facet>
<p:column headerText="Identificación" style="width:10% ; font-size:11px" >
<h:outputText value="#{documento.identificacionComprador}" style="font-size:11px;" />
</p:column>
<p:column headerText="Razón Social" style="width:25% ; font-size:11px">
<h:outputText value="#{documento.razonSocialComprador}" style="font-size:11px;" />
</p:column>
<p:column headerText="Comprobante" style="width:10% ; font-size:11px">
<h:outputText value="#{documento.codigoDocumento}" style="font-size:11px;" />
</p:column>
<p:column headerText="Número" style="width:10% ; font-size:11px">
<h:outputText value="#{documento.id.serie}" style="font-size:11px;" />
</p:column>
<p:column headerText="Importe total" style="width:7% ; text-align:right ; font-size:11px">
<h:outputText value="#{documento.importeTotal}" style="font-size:11px;" />
</p:column>
<p:column headerText="Fecha Emisión" style="width:7% ; text-align:center ; font-size:11px">
<h:outputText value="#{documento.fechaEmision}" style="font-size:11px;" />
</p:column>
<p:column headerText="Ambiente"
style="width:10% ; text-align:center ; font-size:11px">
<h:outputText value="#{documento.id.ambiente}" style="font-size:11px;" />
</p:column>
<p:column headerText="Estado" style="width:20% ; font-size:11px">
<p:row>
<p:column>
<h:outputText value="#{documento.estadoTransaccion}" style="font-size:11px;" />
</p:column>
<p:column>
<p:commandButton update=":frmData:display" oncomplete="detalleEstadoDiag.show()" icon="ui-icon-search" style="float:right;">
<f:setPropertyActionListener
target="#{cabDocumentoMB.seleccionDocumentos}"
value="#{documento}"
/>
</p:commandButton>
</p:column>
</p:row>
</p:column>
<p:column headerText="PDF" style="font-size:11px" >
<p:commandLink action="#{cabDocumentoMB.pdf(documento,'')}"
ajax="false"
disabled="#{CabDocumentoMB.desactivaBotonPDF}"
update=":frmData:datosDetalle22">
<p:graphicImage value="/imagenes/pdf.png" ></p:graphicImage>
<f:setPropertyActionListener
target="#{cabDocumentoMB.documentos}"
value="#{documentos}" >
</f:setPropertyActionListener>
</p:commandLink>
</p:column>
<p:column headerText="XML" style="font-size:11px" >
<p:commandLink
action="#{cabDocumentoMB.xml(documento)}"
ajax="false"
update=":frmData:datosDetalle22"
disabled="#{CabDocumentoMB.desactivaBotonXML}">
<p:graphicImage value="/imagenes/xml.png"></p:graphicImage>
<f:setPropertyActionListener
target="#{cabDocumentoMB.documentos}"
value="#{documentos}">
</f:setPropertyActionListener>
</p:commandLink>
</p:column>
<p:column selectionMode="multiple"/>
</p:dataTable>
<p:dialog header="Detalle de estado" widgetVar="detalleEstadoDiag" resizable="false" width="400" showEffect="explode" hideEffect="explode" style="font-size:11px" >
<h:panelGrid id="display" columns="2" cellpadding="4">
<div align="left" style="font-size:11px;"><h:outputText value="Descripción: " style="font-weight:bold" /></div>
<h:outputText value="#{cabDocumentoMB.seleccionDocumentos.msjError}" />
</h:panelGrid>
</p:dialog>
</h:panelGroup>
</p:panel>
<p:panel id="datosExcel" style="align=center">
<h:commandLink>
<p:graphicImage value="/imagenes/excel.png" />
<p:dataExporter type="xls"
postProcessor="#{manager.postProcessXLS}" target="myData"
fileName="myexcel" />
</h:commandLink>
</p:panel>
</h:form>
</ui:define>
</ui:composition>
</html>
Backing: (PDF Method)
...
JRBeanCollectionDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(detallesAdiciones);
String reportPath = pathReports.get(doc.getId().getCodigoDocumento());
JasperPrint jasperPrint = null;
try {
jasperPrint = JasperFillManager.fillReport(reportPath, obtenerMapaParametrosReportes(obtenerParametrosInfoTriobutaria(doc), obtenerInfoFactura(lstFactDetAdictDocumento,doc)), beanCollectionDataSource);
} catch (JRException e) {
e.printStackTrace();
}
HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();
httpServletResponse.addHeader("Content-disposition", "attachment; filename="+name);
ServletOutputStream servletOutputStream = null;
try {
servletOutputStream = httpServletResponse.getOutputStream();
} catch (IOException e) {
e.printStackTrace();
}
try {
JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream);
} catch (JRException e) {
e.printStackTrace();
}
FacesContext.getCurrentInstance().responseComplete();
Recently I have moved from JSF 2.0 to JSF 2.2 and Primefaces 3.5 to Primefaces 5
I have got a table which has filter on each column. filtering works well using primefaces 3.5
<p:dataTable id="gwsReportAllPartListDataTable"
value="#{viewAllAnalyticsBean.gwsReportPartTwoList}"
var="report"
paginator="true"
rows="100"
paginatorTemplate="{PageLinks} {CurrentPageReport}"
currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}"
emptyMessage="#{dictionary['nothing_is_here']}"
scrollable="true"
scrollWidth="1221"
scrollHeight="500">
<p:ajax event="filter" listener="#{viewAllAnalyticsBean.onFilterDataTable}" oncomplete="updateFilters()"/>
<p:column styleClass="columnCustomClass" style="width: 90px;position:relative; padding-bottom: 30px;">
<f:facet name="header">
<h:outputText value="#{dictionary['reporting_period']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.year}, #{report.gwsReportPartOne.quarter}"/>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 90px;position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.contractNumber}" filterMatchMode="contains" filterStyle="width:80px; position:absolute; bottom:4px;" filterValue="">
<f:facet name="header">
<h:outputText value="#{dictionary['subsoil_user_contract_register_number']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.contractNumber}"/>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 40px;position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.gwsType.code}" filterMatchMode="contains" filterStyle="width:30px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['gws_type']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.gwsType.code}" />
</p:column>
<p:column id="tender_code" width="100" style="position:relative; padding-bottom: 30px;" styleClass="columnCustomClass" filterBy="#{report.skp.code}" filterMatchMode="contains" filterStyle="width:90px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['gws_code_by_skp']}" />
</f:facet>
<h:outputText value="#{report.skp.code}"/>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 150px; position:relative; padding-bottom: 30px;" filterBy="#{report.description}" filterMatchMode="contains" filterStyle="width:140px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['item_name_and_short_description_of_purchased_gws']}" />
</f:facet>
<h:outputText value="#{report.description}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 50px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.tenderType.code}" filterMatchMode="contains" filterStyle="width:40px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['purchase_way']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.tenderType.code}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementNumber}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['agreement_number']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.agreementNumber}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.resultDate}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['tender_result_date']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.resultDate}" >
<f:convertDateTime pattern="dd.MM.yyyy"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementStartDate}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['agreement_conclusion_date']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.agreementStartDate}" >
<f:convertDateTime pattern="dd.MM.yyyy"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementEndDate}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['agreement_deadline_date']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.agreementEndDate}" >
<f:convertDateTime pattern="dd.MM.yyyy"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 50px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementStatus.code}" filterMatchMode="contains" filterStyle="width:40px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['agreement_status']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.agreementStatus.code}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.agreementSum}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['total_sum_of_agreement_without_vat']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
</f:facet>
<h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsReportPartOne.agreementSum)}">
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.plannedSum}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['planned_sum_in_gpz_without_vat']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
</f:facet>
<h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsReportPartOne.plannedSum)}" >
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.actuallyPaidSum}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['actually_paid_sum_for_report_period_of_agreement_without_vat']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
</f:facet>
<h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsReportPartOne.actuallyPaidSum)}" >
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 100px; position:relative; padding-bottom: 30px; background-color: #{two.gwsSumWithoutVatColor}" filterBy="#{report.gwsSumWithoutVat}" filterMatchMode="contains" filterStyle="width:90px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['tender_volume_without_vat_in_price']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
</f:facet>
<h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.gwsSumWithoutVat)}">
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.supplierBinOrIin}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['supplier_bin_iin']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.supplierBinOrIin}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 150px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.supplierName}" filterMatchMode="contains" filterStyle="width:140px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['supplier_gws_name']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.supplierName}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 60px; position:relative; padding-bottom: 30px;" filterBy="#{report.gwsReportPartOne.supplierCountry.code}" filterMatchMode="contains" filterStyle="width:50px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['supplier_gws_country']}" />
</f:facet>
<h:outputText value="#{report.gwsReportPartOne.supplierCountry.code}" />
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.kazcontent}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['local_content_piece']}, %" />
</f:facet>
<h:outputText value="#{report.kazcontent}" >
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText>
<ui:remove><h:outputText value="#{report.kazcontentInService}" >
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText></ui:remove>
</p:column>
<p:column styleClass="columnCustomClass" style="width: 80px; position:relative; padding-bottom: 30px;" filterBy="#{report.procurementSumOfLocalContentOfGws}" filterMatchMode="contains" filterStyle="width:70px; position:absolute; bottom:4px;">
<f:facet name="header">
<h:outputText value="#{dictionary['procurement_sum_of_local_content_of_tru']}, #{viewAllAnalyticsBean.getThTengeOrUsd()}" />
</f:facet>
<h:outputText value="#{viewAllAnalyticsBean.convertValueToCurrentCurrency(report.procurementSumOfLocalContentOfGws)}" >
<f:convertNumber pattern="0.00#" locale="ru-RU"/>
</h:outputText>
</p:column>
<p:columnGroup type="footer">
<p:row>
<p:column footerText="#{dictionary['totals']}: " style="text-align:right"/>
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="#{viewAllAnalyticsBean.totalAgreementSum}" />
<p:column footerText="#{viewAllAnalyticsBean.totalPlannedSum}" />
<p:column footerText="#{viewAllAnalyticsBean.totalActualPaid}" />
<p:column footerText="#{viewAllAnalyticsBean.totalGwsSum}" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="" />
<p:column footerText="#{viewAllAnalyticsBean.averageKazContent} %" />
<p:column footerText="#{viewAllAnalyticsBean.totalGwsLocalContent}" />
</p:row>
</p:columnGroup>
</p:dataTable>
I have onFilterDataTable function which fires each time when user start to type to filter fields on each column.
public void onFilterDataTable(AjaxBehaviorEvent event) {
System.out.println("Filter called");
DataTable table = (DataTable) event.getSource();
filteredGwsReportPartTwoList = table.getFilteredValue();
isFiltered = filteredGwsReportPartTwoList.size() != gwsReportPartTwoList.size();
countTotalsAndGenerateGwsReportPartOne(isFiltered);
}
but in Primefaces shows me that getFilteredValue() returns null when Primefaces 3.5 returns ready filtered list.
What is the problem? And how to check if data table shows already filtered data on server side?
me the same thing has happened to move from version 3.5 to 4.0.
I solved the problem using remotecomand to call actionlistener method.
<p:dataTable filterDelay="1000" emptyMessage="No se encontraron elementos" widgetVar="tb1"
id="tablaFact" var="item" selection="#{listadoFacturasMB.selectedFactura}" selectionMode="single" paginator="true"
rows="20" rowKey="#{item.idFactura}" value="#{listadoFacturasMB.facturaUtilList}" filteredValue="#{listadoFacturasMB.filterFacturaUtilList}">
<p:ajax event="filter" oncomplete="handleLoadStart();" update=":frm1:tablaFact :frm1:panelTotal"/>
<p:column style="width:10%" headerText="Importe Total" id="cff3">
<h:outputText value="#{item.importeTotal}"/>
</p:column>
<p:column style="width:10%" headerText="Importe CUC" id="cjj3">
<h:outputText value="#{item.importeCuc}"/>
</p:column>
</p:dataTable>
<p:remoteCommand id="rcom" name="loadRemoteContent" process="#this" update="panelTotal, tablaFact"
actionListener="#{listadoFacturasMB.filterListener2}"/>
Backingbean
public void filterListener2() {
try {
if (filterFacturaUtilList != null) {
//your code
}
}
} catch (Exception e) {
JsfUtil.addErrorMessage(e, "Error: filterListener() " + e.getMessage());
}
}
in PF 5.0 you need to explicit define filteredValue:
<p:dataTable id="gwsReportAllPartListDataTable"
value="#{viewAllAnalyticsBean.gwsReportPartTwoList}"
var="report"
paginator="true"
rows="100"
paginatorTemplate="{PageLinks} {CurrentPageReport}"
currentPageReportTemplate="{currentPage} #{dictionary['out_of']} {totalPages}"
emptyMessage="#{dictionary['nothing_is_here']}"
scrollable="true"
scrollWidth="1221"
scrollHeight="500"
filteredValue="#{someBeanOrScope.someList}">
Any idea why f:setPropertyActionListener is not working when I'm setting p:dataTable id="inv#{ck001.sequence}", which is a value obtained from the pageBean.
It works ok if I set it to p:dataTable id="inv1", a fixed value
<table class="layout-matrix">
<tr>
<td class="layout-cell" rowspan="3" style="width: 33.33%;">
<p:poll interval="60" listener="#{ck001.refreshData}" update="#form"/>
<div id="availableInventory" style="overflow: scroll; height:1030px" >
<table class="outer-wrap"><tr><td class="outer-cell"><table class="inner-wrap"><tr><td class="inner-cell">
<p:fieldset legend="#{i18n.static.availableInventory}">
<c:forEach var="invBBD" items="#{ck001.distinctBBD}">
<p:panel styleClass="has-footer" >
<p:dataTable id="inv#{ck001.sequence}" var="inv" value="#{ck001.getAvailableInventoryViewModelList(invBBD)}" style="width:300px;">
<f:facet name="header">
<h:outputText value="#{i18n.static.bestBeforeDate}: #{invBBD}" styleClass="strong"/>
</f:facet>
<p:column headerText="#{i18n.static.productDescription}" width="200">
<h:outputText value= "#{inv.productName}" style="display: block; background-color: #{inv.color}"/>
</p:column>
<p:column headerText="#{i18n.static.birdGrade}">
<h:outputText value= "#{inv.birdGrade}" style="display: block; background-color: #{inv.color}"/>
</p:column>
<p:column headerText="#{i18n.static.supplierName}" width="200">
<h:outputText value="#{inv.supplierName}" style="display: block; background-color: #{inv.color}"/>
</p:column>
<p:column headerText="#{i18n.static.quantity}">
<h:outputText value="#{inv.sumOfQuantityOnHand}" style="display: block; background-color: #{inv.color}"/>
</p:column>
<p:column>
<p:commandButton id="chickenReplenishment"
update=":chickenReplenishmentPopupForm:chickenReplenishmentPnl"
process="#this"
oncomplete="chickenReplenishmentPopup.show()"
icon="ui-icon-c34"
title="#{i18n.static.chickenReplenishment}">
<f:setPropertyActionListener value="#{inv}" target="#{ck001.selectedAvailableInventory}" />
<f:setPropertyActionListener value="#{invBBD}" target="#{ck001.selectedBestBeforeDate}" />
<f:setPropertyActionListener value="#{inv.sumOfQuantityOnHand}" target="#{ck001.quantityRequested}" />
</p:commandButton>
</p:column>
</p:dataTable>
</p:panel>
</c:forEach>
</p:fieldset>
</td></tr></table></td></tr></table>
</div>
</td>
....
in the code below there is a form with the name of FormData where every time I submit the data, it updates the entire page. I wish this did not happen when submit the data, it would execute the action q without refreshing the whole page. This behavior is normal or I'm doing something wrong?
My code:
<ui:decorate template="/resources/Template.xhtml">
<ui:define id="content" name="content">
<p:growl id="war"/>
<style type="text/css">
.ok{
color: #336600
}
.erro{
color: #D20005;
}
</style>
<div style="width: 90%; margin-left: auto; margin-right: auto; ">
<br/>
<br/>
<p:panel>
<f:facet name="header">
Lista de Arquivos Armazenados
</f:facet>
<h:form id="pesquisar">
<p:toolbar style="width: 100%;">
<p:toolbarGroup align="left" >
<h:panelGrid columns="1" cellpadding="0">
</h:panelGrid>
</p:toolbarGroup>
<p:toolbarGroup align="right">
<h:panelGrid columns="5" cellpadding="0">
<h:outputLabel value="De: "/>
<p:inputMask mask="99/99/9999" value="#{arquivoBean.dataInicial}" size="10"/>
<h:outputLabel value="Até: "/>
<p:inputMask mask="99/99/9999" value="#{arquivoBean.datafinal}" size="10"/>
<p:commandButton value="Buscar" action="#{arquivoBean.listar()}" ajax="false"/>
<br/>
<p:selectBooleanCheckbox id="check" value="#{arquivoBean.pendente}"
itemLabel="Pendente">
<p:ajax process="#this" event="change" listener="#{arquivoBean.listarPendente()}" />
</p:selectBooleanCheckbox>
</h:panelGrid>
</p:toolbarGroup>
</p:toolbar>
</h:form>
</p:panel>
<br/>
<p:dataTable id="dataTable"
var="Arquivo"
paginator="true"
paginatorPosition="bottom"
rowsPerPageTemplate="100"
rows="100"
sortBy="#{Arquivo.id}"
value="#{arquivoBean.dataModelArquivo}"
rowStyleClass="#{Arquivo.pendente eq 1 ? 'ok' : 'erro'}"
emptyMessage="Você ainda não ativou uma empresa ou não existe postagem para esta Empresa">
<p:column headerText="ID">
#{Arquivo.id}
</p:column>
<p:column headerText="Nome">
#{Arquivo.nomeMury}
</p:column>
<p:column headerText="Envio">
#{Arquivo.dataEnvio}
</p:column>
<p:column headerText="Produto" width="10px;">
<h:form id="formProduto">
<p:commandButton icon="ui-icon-circle-zoomout" value=""
action="#{arquivoBean.listarProdutoPorArquivo()}"
oncomplete="prodDialog.show()"
onclick="listarProd([{name: 'ArquivoId', value:#{Arquivo.id}}]);">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:commandButton>
<p:remoteCommand name="listarProd" action="#{arquivoBean.listarProdutoPorArquivo()}" update=":formDataTable:dataTableProd">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:remoteCommand>
</h:form>
</p:column>
<p:column headerText="Data" width="10px;">
<h:form id="formData">
<p:inputMask id="entrada#{cc.clientId}" mask="99/99/9999" value="#{Arquivo.dataEntrada}"
onkeypress="if (event.keyCode === 13) {
test([{name: 'rowIndex', value:#{Arquivo.id}}]);
return;
}"
size="8">
<f:convertDateTime pattern="dd/MM/yyyy" type="date" timeZone="GMT-03:00"/>
</p:inputMask>
<p:remoteCommand name="test" action="#{arquivoBean.inserirDataNota()}">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:remoteCommand>
</h:form>
</p:column>
</p:dataTable>
<h:form id="formDataTable">
<p:dialog closeOnEscape="true"
widgetVar="prodDialog"
modal="true"
header="Lista de Produtos da NF-e"
style="width: 300; height: 500"
position="center">
<p:dataTable
id="dataTableProd"
var="XmlItens"
paginator="true"
paginatorPosition="bottom"
rowsPerPageTemplate="10"
rows="10"
value="#{arquivoBean.listaProd}">
<p:column headerText="ID">
#{XmlItens.id}
</p:column>
<p:column headerText="Nome">
#{XmlItens.descricaoProd}
</p:column>
<p:column headerText="Envio">
#{XmlItens.chaveNfe}
</p:column>
</p:dataTable>
</p:dialog>
</h:form>
</div>
</ui:define>
</ui:decorate>
First: The method on your managedBean must be void or return a String null
Second: you must write which ones components do you want to update after de action works.
Like primefaces example:
https://www.primefaces.org/showcase/ui/ajax/remoteCommand.xhtml