I made this code here, q aims to list the values of the bank, and that the User can update a date, even through the dataTable. So far, I managed to get to this point, only that, sets the value that the User enters. I can not find this value anywhere in the world, already ran tdo and the value that is typed in the box, does not come. I used several types of variables, but nothing.
<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'}"
>
<p:column headerText="ID">
#{Arquivo.id}
</p:column>
<p:column headerText="Nome">
#{Arquivo.nome}
</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()"
update=":form:dataTableProd"
onclick="listarProd([{name: 'ArquivoId', value:#{Arquivo.id}}]);">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:commandButton>
</h:form>
</p:column>
<p:column headerText="Data" >
<p:inputMask id ="entrada#{cc.clientId}" mask="99/99/9999" value="#{Arquivo.dataEntrada}"
onkeypress="if (event.keyCode === 13) {
test([{name: 'ArquivoId', value:#{Arquivo.id}}]);
return;
};"
size="8">
<f:convertDateTime pattern="dd/MM/yyyy"/>
</p:inputMask>
</p:column>
</p:dataTable>
After much poking around, I found this error inspector elements of chrome, tab networks:
<partial-response id="j_id1"><error><error-name>class java.lang.NullPointerException</error-name><error-message><![CDATA[]]></error-message></error></partial-response>
I fixed remove the form block and put many forms in place a need.
just it make works.
<?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:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core">
<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; ">
<h:form id="form">
<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()}" update=":form:dataTable" ajax="false"/>
<br/>
<p:selectBooleanCheckbox id="check" value="#{arquivoBean.pendente}"
itemLabel="Pendente">
<p:ajax process="#this" event="change" listener="#{arquivoBean.listarPendente()}" update=":form:dataTable" />
</p:selectBooleanCheckbox>
<p:button value="Ajustar Datas" outcome="/telas/armazenado/listaData.xhtml"/>
</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()"
update=":form:dataTableProd"
onclick="listarProd([{name: 'ArquivoId', value:#{Arquivo.id}}]);">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:commandButton>
</h:form>
</p:column>
</p:dataTable>
<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:remoteCommand name="test" action="#{arquivoBean.inserirDataNota()}">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:remoteCommand>
<p:remoteCommand name="listarProd" action="#{arquivoBean.listarProdutoPorArquivo()}" update=":form:dataTableProd">
<f:setPropertyActionListener value="#{Arquivo}" target="#{arquivoBean.arquivo}"/>
</p:remoteCommand>
</p:dialog>
</h:form>
</div>
</ui:define>
</ui:decorate>
</html>
Related
I'm having a problem with primefaces ui. It doesnt render icon that it was supposed to be rendered when I use and the problem is not happening only on this but also on many other pages. I haven't used jquery.
I dont know what's wrong. Googled it but didnt find an answer.
Here is my code
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="/WEB-INF/faces/template.xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:jsf="http://xmlns.jcp.org/jsf" xmlns:p="http://primefaces.org/ui"
xmlns:prettyfaces="http://ocpsoft.com/prettyfaces">
<ui:param name="title" value="List of Employee"/>
<ui:define name="breadcrum1">
<li><h:link value="Employee Management" outcome="pretty:home"/></li>
<li><h:link value="List Employee Record" outcome="pretty:list_employee"/></li>
</ui:define>
<ui:define name="content">
<div class="container">
<div class="row">
<div class="col-xs-10 col-md-10 span3">
<p:messages id="messages" autoUpdate="true" closable="true" globalOnly="true" style="text-align: center;"/>
<h:form id="form">
<p:dataTable
class="panel-primary table table-condensed"
var="employee" value="#{dtLazyView.lazyModel}" paginator="true" rows="10"
emptyMessage="No Employee found with given criteria"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" selectionMode="single" selection="#{dtLazyView.selectedEmployee}" widgetVar="employeeTable" lazy="true">
<f:facet name="header">
Employee Information
<h:outputText value="Search all fields:" />
<p:inputText id="globalFilter" onkeyup="PF('employeeTable').filter()" style="width:150px" placeholder="Enter keyword"/>
</f:facet>
<p:column headerText="Id">
<h:outputText value="#{employee.employeeCode}" />
</p:column>
<p:column headerText="Employee Name">
<h:outputText value="#{employee.employeeName}" />
</p:column>
<p:column headerText="Employee Mobile Number">
<h:outputText value="#{employee.contact.mobileNumber}" />
</p:column>
<p:column headerText="Employee Role" >
<h:outputText value="#{employee.detail.employeeRole}" />
</p:column>
<p:column headerText="Option">
<h:commandButton action="#{employeeEditController.loadData(employee)}" value="Edit" class="btn btn-primary" style="margin-left: 40px;"> <f:ajax execute="#form"/></h:commandButton>
<p:commandButton update=":form:employeeDetail" oncomplete="PF('employeeDialog').show()" icon="ui-icon-search" title="View">
<f:setPropertyActionListener value="#{employee}" target="#{dtLazyView.selectedEmployee}" />
</p:commandButton>
</p:column>
</p:dataTable>
<p:dialog header="Employee Info" widgetVar="employeeDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false" styleClass="">
<p:outputPanel id="employeeDetail" style="text-align:center;">
<p:panelGrid columns="2" rendered="#{not empty dtLazyView.selectedEmployee}" columnClasses="label,value">
<f:facet name="header">
<img src="../../imageshandler/#{dtLazyView.selectedEmployee.employeePicture}" class="img-responsive" style="width:200px;height: 200px;margin-left: 100px;border-radius: 50%"/>
</f:facet>
<h:outputText value="Name :" style="color: black"/>
<h:outputText value="#{dtLazyView.selectedEmployee.employeeName}" />
<h:outputText value="DOB :" style="color: black"/>
<h:outputText value="#{dtLazyView.selectedEmployee.employeeDob}" />
<h:outputText value="Gender :" style="color: black"/>
<h:outputText value="#{dtLazyView.selectedEmployee.sex}" style="color:#{dtSelectionView.selectedCar.color}"/>
<h:outputText value="Salary : " style="color: black" />
<h:outputText value="Rs : #{dtLazyView.selectedEmployee.salary.basicSalary}" />
<h:outputText value="Working date :" style="color: black"/>
<h:outputText value="#{dtLazyView.selectedEmployee.employeeDateOfCommencement}"/>
<h:outputText value="Employee Job Specification :" style="color: black"/>
<h:inputTextarea value="#{dtLazyView.selectedEmployee.detail.jobSpecification}" readonly="true"/>
</p:panelGrid>
</p:outputPanel>
</p:dialog>
</h:form>
</div>
</div>
</div>
</ui:define>
According to Primefaces, you can use Font Awesome for the icons, so try replacing
icon="ui-icon-search"
with
icon="fa fa-search"
Keep in mind
Font Awesome icons are provided out of the box within PrimeFaces. In
order to enable Font Awesome support, enable primefaces.FONT_AWESOME
setting as true via a context param.
Whatever I try, the listener="#{aufwandDayEditController.initAufwaendeJeTag}" of the event="dateSelect" in the is never called.
Here the facelet:
<h:head>
<title>Aufwand je Tag erfassen</title>
<h:outputStylesheet name="css/style.css" />
</h:head>
<h:body>
<h:form id="form">
<ui:include src="/common/menu.xhtml"/>
<p:panel id="panel" header="Aufwand je Tag" style="width: 800px">
<p:panelGrid id="attribute" columns="2">
<p:outputLabel for="mitarbeiter" value="Mitarbeiter:"/>
<p:selectOneMenu id="mitarbeiter"
value="#{aufwandDayEditController.mitarbeiter}"
editable="false"
effect="fade"
converter="#{mitarbeiterConverter}"
required="true"
requiredMessage="Mitarbeiter muss angegeben werden!">
<f:selectItems value="#{aufwandDayEditController.mitarbeiterSelectItems}"/>
<p:ajax listener="#{aufwandDayEditController.initAufwaendeJeTag}"
update="aufwaende"/>
<p:ajax update="addRow"/>
</p:selectOneMenu>
<p:outputLabel for="tag"
value="Tag:"/>
<p:calendar id="tag"
value="#{aufwandDayEditController.tag}"
required="true"
requiredMessage="Tag muss angegeben werden!"
locale="de"
navigator="true"
yearRange="c-10:c+10">
<p:ajax event="dateSelect"
listener="#{aufwandDayEditController.initAufwaendeJeTag}"
update="aufwaende"/>
<p:ajax event="dateSelect"
update="addRow"/>
</p:calendar>
<p:outputLabel value="Aufwände:"
for="aufwaende"/>
<p:dataTable id="aufwaende"
var="aufwand"
value="#{aufwandDayEditController.aufwaendeJeTag}"
sortBy="#{aufwand.aktivitaet}"
rendered="#{aufwandDayEditController.aufwaendeJeTag != null}"
editable="true"
editMode="row"
resizableColumns="true">
<f:facet name="header">Aufwände</f:facet>
<p:ajax event="rowEdit"
listener="#{aufwandDayEditController.onRowEdit}"
update=":form:message"/>
<p:ajax event="rowEditCancel"
listener="#{aufwandDayEditController.onRowEditCancel}"
update=":form:message"/>
<p:column headerText="Aktivität" style="vertical-align: middle;" resizable="true">
<p:cellEditor>
<f:facet name ="output">
<h:outputText value="#{aufwand.aktivitaet.toString()}"/>
</f:facet>
<f:facet name="input">
<p:selectOneMenu value="#{aufwand.aktivitaet}"
editable="false"
effect="fade"
converter="#{aktivitaetConverter}"
required="true"
requiredMessage="Projektaktivität muss angegeben werden!"
style="width:70%; line-height: 85%; text-align: left">
<f:selectItems value="#{aufwandDayEditController.aktivitaetSelectItems}"/>
</p:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Aufwand [pH]" style="vertical-align: middle;" resizable="true">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{aufwand.menge}"/>
</f:facet>
<f:facet name="input">
<p:inputText id="menge"
value="#{aufwand.menge}"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column resizable="true">
<p:rowEditor />
</p:column>
</p:dataTable>
<p:outputLabel/>
<p:commandButton id="addRow"
icon="add"
title="Neue Zeile"
value="Neue Zeile"
actionListener="#{aufwandDayEditController.onAddRow}"
update="aufwaende"
disabled="#{aufwandDayEditController.mitarbeiter == null or aufwandDayEditController.tag == null}"/>
</p:panelGrid>
<p:growl id="message" showDetail="true" showSummary="false"/>
</p:panel>
<p:commandLink value="Zurück"
immediate="true"
action="#{aufwandDayEditController.back()}"/>
</h:form>
</h:body>
</html>
And here the interesting part of the associated controller:
public void initAufwaendeJeTag(Object dummy) {
initAufwaendeJeTag();
}
public void initAufwaendeJeTag() {
if (mitarbeiter != null && tag != null) {
aufwaendeJeTag = aufwandFacade.findByDay(mitarbeiter, tag);
}
else {
aufwaendeJeTag = new LinkedList<>();
}
}
Please note that the listener without the parameter is called perfectly from component id="mitarbeiter" but the neither of them is called from component id="tag". is working correctly as value="#{aufwandDayEditController.tag}" is updated ...
Checked this with debugger ...
Any help available?
I'm using PrimeFaces 5.1, NetBeans 8.0.1, ...
Oh, found it out ... it seems, that a consumes an event so that only one (in my case the 2nd one) responds to it.
The solution is that I have to alter the update="" attribute ...
Below is my code in .xhtml file. I need to add ajax call in one of the inputtextbox component. Say.. on blur of inputtextbox where id="search_dias" i should make ajax call with popup window showing the response value and then i should place that value in inputTextBox where id="search_partyName"
<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:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:form>
<p:panel id="panel1" styleClass ="myPanelStyle1" header="SEARCH PRODUCTIONS " toggleable="true" toggleSpeed="100">
<h:panelGrid columns="3" border="0" rules="group">
<p:column >
<h:outputLabel for="search_dia" value="Diameter:"/>
</p:column>
<p:column>
<p:inputText id="search_dias" value="#{addFormRequest.diameter}"/>
</p:column>
<p:tooltip for="search_dias" value="Enter Dia Value" showEffect="fade" hideEffect="fade" />
<p:column >
<h:outputLabel for="search_partyName" value="PartyName:"/>
</p:column>
<p:column>
<p:inputText id="search_partyName" value="#{addFormRequest.search_partyName}"/>
</p:column>
<p:tooltip for="search_partyName" value="Enter Party Name" showEffect="fade" hideEffect="fade" />
<p:column >
<h:outputLabel for="search_date" value="Date:"/>
</p:column>
<p:calendar id="search_date" value="#{addFormRequest.search_date}"/>
<p:tooltip for="search_date" value="Enter Production Date" showEffect="fade" hideEffect="fade" />
<p:commandButton id="searchProductions" value="SEARCH" action="search" />
</h:panelGrid>
</p:panel>
</h:form>
The answers can be found here:
Show dialog on dataTable row selection
Inputtext blur event
Show dialog on ajax event in dataTable
I am trying to user a form in 'panelGrid' to render values in a dataTable using <f:ajax>. However, when submitting using the <h:commandButton> the values sent are not displayed in the dataTable. I am not getting a stack or any console errors in the browsers.
This is the my xhtml (Simplified):
Product Catalog:
<p:tabView id="tabView" style="width: 65%" >
<p:tab id="books" title="Books">
<p:dataGrid var="book" value="#{saleBean.productList}" columns="3"
rows="9" paginator="true" paginatorTemplate="{CurrentPageReport}
{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
{LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="3,6,9">
<h:form id="product" >
<p:panel header="#{book.name}" style="text-align: center">
<h:panelGrid columns="1" style="width: 65%">
<!-- Add Book Images here -->
<h:outputText value="#{book.price}"/>
<h:outputLabel value="Dct (in dollars): " />
<h:inputText id="discount" value="#{saleBean.item.unit_discount}" style="width: 50%" />
<p:commandButton value="Add to Cart" update=":dataTableForm:sc"
action="#{saleBean.doAddItem}"/>
</h:panelGrid>
</p:panel>
</h:form>
</p:dataGrid>
</p:tab>
<p:tab id="arts" title="Art / Various">
<!-- Art Products to be added here -->
</p:tab>
<p:tab id="other" title="Other">
<!-- Various Products to be Added here -->
</p:tab>
</p:tabView>
<hr/>
<h1>Shopping Cart</h1>
<hr/>
<h:form id="dataTableForm">
<p:dataTable id="sc" value="#{saleBean.sd}" var="item" style="width: 60%">
<p:column>
<f:facet name="header">
<h:outputText value="Product"/>
</f:facet>
<h:outputText value="#{item.product_fk}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Quantity"/>
</f:facet>
<h:outputText value="#{item.quantity}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Unit Price"/>
</f:facet>
<h:outputText value="#{item.unit_Cost}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Unit Discount"/>
</f:facet>
<h:outputText value="#{item.unit_discount}"/>
</p:column>
</p:dataTable>
</h:form>
</h:body>
This the bean (Simplified):
public String doAddItem()
{
item.setUnit_Cost(product.getPrice());
item.setProduct_fk(product);
item.setQuantity(1);
sd.add(item);
return "productCatalog";
}
According to PrimeFaces documentation :
http://www.primefaces.org/docs/vdl/3.4/primefaces-p/commandButton.html
Your actionListener="#{saleBean.doAddItem}" must use a function corresponding to that :
public void doAddItem(ActionListener event)
{
// do your stuff
}
To use action here is an example :
action="#{saleBean.doAddItem}"
public String doAddItem(void)
{
item.setUnit_Cost(product.getPrice());
item.setProduct_fk(product);
item.setQuantity(1);
sd.add(item);
return "productCatalog";
}
Try to use only pf components when you can eg p:datatable. Replace the button with a p:commandButton and use process and update instead of f:ajax.
Also maybe it will by better to include the p:datatable in the form too.
I don't know how to reference descendant components of composite component in update or process (alias render or execute).
I have this composite component resources/components/crud.xhtml:
<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"
xmlns:c="http://java.sun.com/jsf/composite">
<c:interface>
<c:attribute name="controller" required="true" />
<c:facet name="fields" required="true"/>
</c:interface>
<c:implementation>
<p:dataTable
id="table"
value="#{cc.attrs.controller.autoResultModel}"
var="unit"
paginator="true"
rows="10"
lazy="true"
paginatorAlwaysVisible="true"
paginatorPosition="top"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="{totalRecords} records found, Page: {currentPage}/{totalPages}"
rowsPerPageTemplate="5,10,15"
sortBy="#{unit.creationTime}"
sortOrder="descending"
selectionMode="single"
selection="#{cc.attrs.controller.selected}">
<p:ajax event="rowSelect" update="editDialog trashDialog table:commands"/>
<f:facet name="header">
<h:panelGroup id="commands" layout="block">
<p:commandButton id="newButton" value="new" image="ui-icon ui-icon-plusthick" oncomplete="editDialog.show()" actionListener="#{cc.attrs.controller.clearSelected()}" process="#this" update="#{cc.clientId}" />
<p:commandButton value="edit" image="ui-icon ui-icon-wrench" onclick="editDialog.show()" type="button" disabled="#{cc.attrs.controller.selected.id == null}"/>
<p:commandButton value="delete" image="ui-icon ui-icon-trash" onclick="trashDialog.show()" type="button" disabled="#{cc.attrs.controller.selected.id == null}"/>
</h:panelGroup>
</f:facet>
<c:insertChildren/>
</p:dataTable>
<h:panelGroup id="editDialog">
<p:dialog modal="true" widgetVar="editDialog" showEffect="fold" hideEffect="puff">
<f:facet name="header">
<h:outputText value="#{bundle['create']}" rendered="#{cc.attrs.controller.selected.id == null}"/>
<h:outputText value="#{bundle['update']}" rendered="#{cc.attrs.controller.selected.id != null}"/>
</f:facet>
<h:panelGroup layout="block">
<c:renderFacet name="fields"/>
<br/>
<p:commandButton value="#{bundle['create']}" actionListener="#{cc.attrs.controller.create}" process="editDialog" update="table" oncomplete="closeDialog(xhr, status, args, editDialog)" rendered="#{cc.attrs.controller.selected.id == null}"/>
<p:commandButton value="#{bundle['update']}" actionListener="#{cc.attrs.controller.update}" process="editDialog" update="table" oncomplete="closeDialog(xhr, status, args, editDialog)" rendered="#{cc.attrs.controller.selected.id != null}"/>
<p:commandButton value="#{bundle['copy']}" actionListener="#{cc.attrs.controller.create}" process="editDialog" update="table" oncomplete="closeDialog(xhr, status, args, editDialog)" rendered="#{cc.attrs.controller.selected.id != null}">
<f:setPropertyActionListener target="#{cc.attrs.controller.selected.id}" value="#{null}"/>
</p:commandButton>
</h:panelGroup>
</p:dialog>
</h:panelGroup>
<p:dialog modal="true" header="asdasd" widgetVar="trashDialog" hideEffect="explode" showEffect="explode">
<h:panelGroup id="trashDialog" layout="block">
<h:outputText value="#{bundle['trashconfirm']}">
<f:param name="name" value="#{cc.attrs.controller.selected.name}"/>
</h:outputText>
</h:panelGroup>
<p:commandButton value="#{bundle['confirm']}" actionListener="#{cc.attrs.controller.destroy}" process="#this" update="table" oncomplete="closeDialog(xhr, status, args, trashDialog)"/>
</p:dialog>
</c:implementation>
</html>
called by this page test.xhtml:
<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"
xmlns:cc="http://java.sun.com/jsf/composite/components">
<h:head>
<title>Default Title</title>
<h:outputStylesheet name="css/screen.css"/>
<h:outputScript name="js/common.js"/>
</h:head>
<h:body>
<p:growl id="messages" autoUpdate="true"/>
<h:form id="itemForm">
<cc:crud id="itemCrud" controller="#{itemController}">
<f:facet name="fields">
<h:panelGrid columns="3">
<h:outputLabel value="manufacturer" for="manufacturer"/>
<p:selectOneMenu id="manufacturer" value="#{itemController.selected.manufacturer}" converter="#{manufacturerController.converter}">
<f:selectItems value="#{manufacturerController.facade.findAll()}" var="e" itemLabel="#{e.title}" itemValue="#{e}"/>
</p:selectOneMenu>
<p:message for="manufacturer"/>
<h:outputLabel value="partNumber" for="partNumber"/>
<p:inputText id="partNumber" value="#{itemController.selected.partNumber}"/>
<p:message for="partNumber"/>
<h:outputLabel value="configurationIndex" for="configurationIndex"/>
<p:inputText id="configurationIndex" value="#{itemController.selected.configurationIndex}"/>
<p:message for="configurationIndex"/>
</h:panelGrid>
</f:facet>
<p:column headerText="#{bundle['manufacturer']}" filterBy="#{unit.manufacturer.title}" sortBy="#{unit.manufacturer.title}">
#{unit.manufacturer.title}
</p:column>
<p:column headerText="#{bundle['partNumber']}" filterBy="#{unit.partNumber}" sortBy="#{unit.partNumber}">
#{unit.partNumber}
</p:column>
<p:column headerText="#{bundle['configurationIndex']}" filterBy="#{unit.configurationIndex}" sortBy="#{unit.configurationIndex}">
#{unit.configurationIndex}
</p:column>
<p:column headerText="#{bundle['modifyStatus']}" filterBy="#{unit.modifyStatus}" sortBy="#{unit.modifyStatus}">
#{unit.modifyStatus}
</p:column>
<p:column headerText="#{bundle['description']}" filterBy="#{unit.description}" sortBy="#{unit.description}">
#{unit.description}
</p:column>
</cc:crud>
</h:form>
</h:body>
</html>
And I have this output:
AVVERTENZA: PWC4011: Unable to set request character encoding to UTF-8 from context /epcsdb, because request parameters have already been read, or ServletRequest.getReader() has already been called
INFO: Skipping call to libraryExists(). Please set context-param com.sun.faces.enableMissingResourceLibraryDetection to true to verify if library http://java.sun.com/jsf/composite/components actually exists
INFO: Cannot find component with identifier "itemForm:itemCrud:table:newButton" in view.
INFO: Cannot find component with identifier "itemForm:itemCrud" in view.
INFO: Cannot find component with identifier "editDialog" in view.
INFO: Cannot find component with identifier "trashDialog" in view.
INFO: Cannot find component with identifier "itemForm:itemCrud:j_idt34" in view.
Result of this is that no component is updated with any ajax call. I don't understand why "itemForm:itemCrud:table:newButton" cannot be found. It is only referenced with process="#this".
I'm using primefaces 3.0.RC1-SNAPSHOT and Mojarra 2.1.3_01.
You need to prefix absolute client IDs with the NamingContainer separator which is by default :.
update=":#{cc.clientId}"
See also:
How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar"