I have a datatable includes some cell for edit, and these cells are disabled in specific conditions and after an other cell edition will be enabled.
My problem is after the edit, the new data stored in the database but the datatable not updated directly, it will be updated after reloading the page.
All what I want is how can I make the hole datatable updated after the edit or making the page reloaded
and here is my code:
<h:form id="process">
<p:remoteCommand name="onCellEdit" update=":process:ListC" />
<p:dataTable id="ListC"
value="#{recruitmentProcessMB.candidateListInProcess}"
var="candid" rowKey="#{candid.idCandidate}"
style="border:0px; " paginator="true"
paginatorTemplate="{PreviousPageLink} {NextPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="3,5,10" paginatorPosition="top"
rows="10" editable="true" editMode="cell">
<f:facet name="footer" >
<h:outputLabel value="Valider processus pour le Manager:" style="display: inline-block;"/>
<h:selectOneMenu id="managersInProcess" style="display: inline-block;"
value="#{recruitmentProcessMB.selectedManagerInProcess}">
<f:selectItem itemLabel="Selectionner..." itemValue="#{null}"/>
<f:selectItems value="#{recruitmentProcessMB.managersInProcess}" />
</h:selectOneMenu>
<h:outputText value=" " />
<h:outputText value=" " />
<h:outputText value=" " />
<h:outputText value=" " />
<h:outputText value=" " />
<p:commandButton icon="ui-icon-seek-next"
value="Valider le processus"
ajax="true"
style="display: inline-block;"
disabled="false"></p:commandButton>
</f:facet>
<p:ajax event="cellEdit"
update=":process:ListC"
immediate="true"
listener="#{recruitmentProcessMB.onCellEdit}"
process="#this"
oncomplete="onCellEdit()"
/>
<p:column headerText="Prenom">
<h:outputText value="#{candid.firstNameCandidate}" />
</p:column>
<p:column headerText="Nom">
<h:outputText value="#{candid.nameCandidate}" />
</p:column>
<p:column headerText="Specialité">
<h:outputText value="#{candid.specialityCandidate}" />
</p:column>
<p:column headerText="Niveau d'etude">
<h:outputText value="#{candid.levelStudyCandidate}" />
</p:column>
<p:column headerText="CV" style="text-align: center ;width:30px;">
<p:commandButton icon="ui-icon-arrowthickstop-1-s"
ajax="false"
actionListener="#{recruitmentProcessMB.downloadAction(candid.cvCandidate,candidate.nameCandidate,candidate.firstNameCandidate)}">
<p:fileDownload
value="#{recruitmentProcessMB.downloadContentProperty}" />
</p:commandButton>
</p:column>
<p:column headerText="Manager" style="position:center;">
<h:outputText
value="#{candid.employee.firstNameEmployee} #{candid.employee.nameEmployee}" />
</p:column>
<p:column headerText="Date d'entretien">
<p:cellEditor id="c1">
<f:facet name="output">
<h:outputText value="#{candid.interviewDateCandidate}">
<f:convertDateTime type="date" dateStyle="short"
pattern="dd/MM/yyyy" timeZone="Europe/Paris" />
</h:outputText>
</f:facet>
<f:facet name="input" >
<p:calendar id="dateInterview"
value="#{candid.interviewDateCandidate}"
navigator="true" pattern="dd/MM/yyyy" mask="true" immediate="true" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Validation Par Manager " >
<p:cellEditor id="c2">
<f:facet name="output" >
<h:outputText
value="#{candid.decisionOfManager}" />
</f:facet>
<f:facet name="input" >
<h:selectOneMenu id="manegerDecision" style="display: inline-block;"
value="#{candid.decisionOfManager}"
disabled="#{candid.currentTask!='InterviewAndValidationByManager'}"
immediate="true">
<f:selectItem itemLabel="Selectionner..." />
<f:selectItem itemLabel="Accepté" itemValue="Accepté"/>
<f:selectItem itemLabel="Refusé" itemValue="Refusé"/>
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Validation Par RH " >
<p:cellEditor id="c3" >
<f:facet name="output">
<h:outputText
value="#{candid.decisionOfRh}" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu id="rhDecision" style="display: inline-block;"
value="#{candid.decisionOfRh}"
disabled="#{candid.currentTask!='InterviewAndValidationByRH'}"
immediate="true">
<f:selectItem itemLabel="Selectionner..." />
<f:selectItem itemLabel="Accepté" itemValue="Accepté"/>
<f:selectItem itemLabel="Refusé" itemValue="Refusé"/>
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
</p:column>
</p:dataTable>
</h:form>
Related
I saw this problem here many times but it doesn't help me.
I have the first dataTable with id:servers and I can do right click over a row and a contextMenu appears. I can click in Show Process and I get a second dataTable with id:processes.
But here is the problem, instead of showing the new dataTable I get,
javax.faces.FacesException: DataModel must implement
org.primefaces.model.SelectableDataModel when selection is enabled or
you need to define rowKey attribute
But I have defined rowKey in both dataTable
I have this code:
<h:form id="form" onkeypress="return event.keyCode != 13">
<!-- <p:messages id="msgs" /> -->
<p:growl id="msgs" showDetail="true" sticky="true" autoUpdate="true" />
<!-- Context menu for servers table. -->
<p:contextMenu for="servers">
<p:menuitem value="Show processes" update="form" icon="ui-icon-search" actionListener="#{homeBean.findLSRunningProcesses}" styleClass="homeIE"/>
</p:contextMenu>
<!-- Context menu for processes table. -->
<p:contextMenu for="processes">
<p:menuitem styleClass="homeIE" update="#form" value="Stop Process" icon="ui-icon-stop" oncomplete="stopDialog.show()"/>
</p:contextMenu>
<!-- Servers table. -->
<p:dataTable id="servers" var="server" value="#{homeBean.serverList}" paginator="true" rows="10"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15" widgetVar="serversTable" rowKey="#{server.adminFQDN}"
selection="#{homeBean.selectedLogicalServer}" selectionMode="single" emptyMessage="No servers found with given criteria">
<f:facet name="header">
<h:outputText value="Servers" />
</f:facet>
<p:column filterBy="#{server.ASSETID}" filterMatchMode="contains" sortBy="#{server.ASSETID}" headerText="ASSETID">
<h:outputText value="#{server.ASSETID}" />
</p:column>
<p:column filterBy="#{server.adminFQDN}" filterStyle="width:240px;" filterMatchMode="contains" sortBy="#{server.adminFQDN}" headerText="FQDN">
<h:outputText value="#{server.adminFQDN}" />
</p:column>
<p:column filterBy="#{server.adminIP}" filterMatchMode="contains" sortBy="#{server.adminIP}" headerText="Admin IP">
<h:outputText value="#{server.adminIP}" />
</p:column>
<p:column filterBy="#{server.delivery}" filterMatchMode="exact" sortBy="#{server.delivery}" headerText="Delivery">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="false" />
<f:selectItems label="#{homeBean.deliveries}" value="#{homeBean.deliveries}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.delivery}" />
</p:column>
<p:column filterBy="#{server.environment}" filterMatchMode="exact" sortBy="#{server.environment}" headerText="Environment">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" noSelectionOption="true" itemValue="#{null}"/>
<f:selectItems value="#{homeBean.environments}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.environment}" />
</p:column>
<p:column filterBy="#{server.function}" filterMatchMode="exact" sortBy="#{server.function}" headerText="Function">
<f:facet name="filter">
<p:selectOneMenu onchange="PF('serversTable').filter()">
<f:selectItem itemLabel="Select One" itemValue="#{null}" noSelectionOption="true" />
<f:selectItems value="#{homeBean.functions}" />
</p:selectOneMenu>
</f:facet>
<h:outputText value="#{server.function}" />
</p:column>
<p:column filterBy="#{server.osVersion}" filterMatchMode="contains" sortBy="#{server.osVersion}" headerText="OS VERSION">
<h:outputText value="#{server.osVersion}" />
</p:column>
<p:column filterBy="#{server.os}" filterMatchMode="contains" sortBy="#{server.os}" headerText="OS">
<h:outputText value="#{server.os}" />
</p:column>
</p:dataTable>
<!-- Panel containing processes tables. -->
<p:panelGrid id="serverProcesses" styleClass="group-user-selection-table" rendered="#{homeBean.showSelectionPanel}">
<f:facet name="header">
<p:row>
<p:column>
<h:outputText value="#{homeBean.selectedLogicalServer.adminFQDN}" />
</p:column>
</p:row>
</f:facet>
<p:row>
<!--Processes table. -->
<p:column>
<p:dataTable id="processes" var="process" value="#{homeBean.processesList}" filteredValue="#{homeBean.filteredProcesses}"
selection="#{homeBean.selectedProcesses}" paginator="true" rows="15" rowKey="#{process.owner}"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="15,20,25,30" selectionMode="single" emptyMessage="No processses found with given criteria">
<f:facet name="header">
<h:outputText value="Processes" />
</f:facet>
<p:column name="owner" filterBy="#{process.owner}" filterMatchMode="contains" sortBy="#{process.owner}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'DESCRIPTION' : 'OWNER'}">
<h:outputText value="#{process.owner}" />
</p:column>
<p:column name="pid" filterBy="#{process.pid}" filterMatchMode="exact" sortBy="#{process.owner}" headerText="PID">
<h:outputText value="#{process.pid}" />
</p:column>
<p:column name="ppid" filterBy="#{process.ppid}" filterMatchMode="exact" sortBy="#{process.ppid}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'TYPE' : 'PPID'}">
<h:outputText value="#{process.ppid}" />
</p:column>
<p:column name="c" filterBy="#{process.c}" filterMatchMode="exact" sortBy="#{process.c}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'STATE' : 'C'}">
<h:outputText value="#{process.c}" />
</p:column>
<p:column name="stime" filterBy="#{process.stime}" filterMatchMode="contains" sortBy="#{process.stime}" headerText="STIME" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.stime}" />
</p:column>
<p:column name="tty" filterBy="#{process.tty}" filterMatchMode="contains" sortBy="#{process.tty}" headerText="TTY" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.tty}" />
</p:column>
<p:column name="time" filterBy="#{process.time}" filterMatchMode="contains" sortBy="#{process.time}" headerText="TIME" rendered="#{!(homeBean.selectedLogicalServer.os eq 'Windows')}">
<h:outputText value="#{process.time}" />
</p:column>
<p:column name="cmd" filterBy="#{process.cmd}" filterMatchMode="contains" sortBy="#{process.cmd}" headerText="#{homeBean.selectedLogicalServer.os eq 'Windows' ? 'NAME' : 'CMD'}">
<h:outputText value="#{process.cmd}" />
</p:column>
</p:dataTable>
</p:column>
</p:row>
</p:panelGrid>
<p:dialog header="Stop Process" widgetVar="stopDialog" minHeight="40" styleClass="dialogPosition">
<h:outputText value="You are going to stop the process "/>
<h:outputText value="#{homeBean.selectedProcesses.cmd}"/>
<h:outputText value="with PID"/>
<h:outputText value="#{homeBean.selectedProcesses.pid}"/>
<br /><br /><br /><br />
<p:commandButton value="Yes" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="float:left" onclick="stopDialog2.show();stopDialog.hide();" actionListener="#{homeBean.attrListener}">
<f:attribute name="processPID" value="#{process.pid}" />
</p:commandButton>
<p:commandButton value="NO" onclick="stopDialog.hide()" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="float:right"/>
</p:dialog>
<p:dialog header="Stop Process" widgetVar="stopDialog2" minHeight="40" styleClass="dialogPosition">
<h:outputText value="You are going to send an email to:"/>
<br />
<h:outputText value="#{homeBean.email}"/>
<br /><br /><br />
<p:commandLink value="Yes" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" style="float:left" update="form" action="#{homeBean.stopProcess}" oncomplete="stopDialog2.hide();"/>
<p:commandButton value="NO" onclick="stopDialog2.hide()" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" style="float:right"/>
</p:dialog>
</h:form>
FacesException: DataModel must implement org.primefaces.model.SelectableDataModel when selection is enabled
this solution works to me.
Especially this answer https://stackoverflow.com/a/10527008/5250930
The table must implement the SelectableDataModel
I am sorry for my English. I have a JBoss Seam Project and using primefaces in user interface.We have a dialog and inside a datatable. When i select a row im getting following error
ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (http-localhost-127.0.0.1-8080-1) javax.resource.ResourceException: IJ000460: Error checking for a transaction
PersistenceException org.hibernate.exception.GenericJDBCException: Could not open connection
I thought maybe this error about hibernate but When i tired a lot of way about this problem i couldnt done it But when i moved dialog to new xhtml page it was done.I want to use dialog for my project instead of new page.Where is my mistake following code?
<h:form id="vehicleForm">
<p:commandButton id="selectClientButton" value="Musteri Sec" actionListener="#{clientFacade.clientSearchClear()}" />
</h:form>
<h:form id="selectClientForm">
<p:dialog widgetVar="selectClientDialog" resizable="true" draggable="true" modal="true" header="Arac Satis">
<h:panelGrid columns="4">
<h:outputText value="Adi" />
<h:outputText value="Soy Adı" />
<h:outputText value="TC/Vergi No." />
<h:outputText value="" />
<p:inputText value="#{clientFacade.client.name}" />
<p:inputText value="#{clientFacade.client.lastName}" />
<p:inputText value="#{clientFacade.client.taxNo}" />
<p:commandButton value="ARA" update=":selectClientForm:clientListDT" />
</h:panelGrid>
<p:dataTable id="clientListDT" rows="10" value="#{clientFacade.clientList}" var="client" >
<p:column style="width:3%" >
<p:commandLink id="test" actionListener="#{vehicleStockFacade.selectClient(client.clientId)}" ajax="false" >
<h:graphicImage value="#{icon.icon_select_mine_small}" rendered="#{client.isMyClient}" title="#{msg.choose}" width="15" height="15"/>
<h:graphicImage value="#{icon.icon_select_not_mine_small}" rendered="#{!client.isMyClient}" width="15" height="15" />
</p:commandLink>
</p:column>
<p:column>
<f:facet name="header" >
<h:outputText value="#{msg.client_name}" />
</f:facet>
<h:outputText value="#{client.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.client_lastname}" />
</f:facet>
<h:outputText value="#{client.lastName}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.tax_no}" />
</f:facet>
<h:outputText value="#{client.taxNo}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.cell_phone}" />
</f:facet>
<h:outputText value="#{clientFacade.useMaskForPhone(client.mobilePhone)}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.town}" />
</f:facet>
<h:outputText value="#{client.town}" />
</p:column>
<p:column>
<f:facet name="header" id="headerId" >
<h:outputText value="#{msg.address}" />
</f:facet>
<h:outputText value="#{client.addressLine1}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{msg.post_code}" />
</f:facet>
<h:outputText value="#{client.postCode}" />
</p:column>
</p:dataTable>
<f:facet name="footer">
<p:commandButton value="Secimi Kaldir" action="#{vehicleStockFacade.removeClientFromVehicleStock()}" style="float:right;margin-bottom:5px" ajax="false" />
</f:facet>
</p:dialog>
</h:form>
I am trying to update the selected row (object) in <p:dataTable> when user clicks on the context menu but the object bound to <p:dataTable> selection="" doesn't updates according to row selection/context menu click, the debugging showed that the object's attributes in the bean doesn't contain any updated values but empty.
The code is:
<h:form id="searchStdentsFrm">
<p:dialog id="searchStdentsDlg" header="Search Students" widgetVar="srchStdents" modal="true">
<p:contextMenu for="srchStdentsTble" id="menuStdEdit">
<p:menuitem value="Change Status" update="stdDetail" icon="ui-icon-flag" oncomplete="PF('editStudentDialog').show()" />
<p:menuitem value="Edit Student" update="stdStatusDetail" icon="ui-icon-wrench" oncomplete="PF('editStudentStatusDialog').show()" action="#{viewStudentsBean.testAction}"/>
</p:contextMenu>
<p:dataTable id="srchStdentsTble" var="student" value="#{viewStudentsBean.studentsList}"
rowKey="#{student.id}" selection="#{viewStudentsBean.selectedStudent}"
selectionMode="single" widgetVar="srchStdentTbl"
emptyMessage="No students found with the given criteria" filteredValue="#{viewStudentsBean.filteredStudents}">
<p:ajax event="contextMenu"/>
<f:facet name="header">
<p:outputPanel>
<h:outputText value="Search Students:" />
<p:inputText id="globalFilter" onkeyup="PF('srchStdentTbl').filter()" style="width:200px" placeholder="Enter keyword"/>
</p:outputPanel>
</f:facet>
<p:column id="stdentId" headerText="Id" filterBy="#{student.id}" filterStyle="display:none">
<h:outputText value="#{student.id}" />
</p:column>
<p:column id="stdentFirstName" headerText="Firstname" filterBy="#{student.firstName}" filterStyle="display:none">
<h:outputText value="#{student.firstName}" />
</p:column>
<p:column id="stdentLastname" headerText="Lastname" filterBy="#{student.lastName}" filterStyle="display:none">
<h:outputText value="#{student.lastName}" />
</p:column>
<p:column id="stdentFathername" headerText="Father name" filterBy="#{student.fatherName}" filterStyle="display:none">
<h:outputText value="#{student.fatherName}" />
</p:column>
<p:column id="stdentGender" headerText="Gender" filterBy="#{student.gender}" filterStyle="display:none">
<h:outputText value="#{student.gender}" />
</p:column>
<p:column id="stdentDOB" headerText="Date Of birth" filterBy="#{student.dob}" filterStyle="display:none">
<h:outputText value="#{student.dob}" />
</p:column>
<p:column id="stdentSkype" headerText="Skype/Email" filterBy="#{student.skypeOrEmailId}" filterStyle="display:none">
<h:outputText value="#{student.skypeOrEmailId}" />
</p:column>
<p:column id="stdentPhone" headerText="Phone No" filterBy="#{student.phoneNumber}" filterStyle="display:none">
<h:outputText value="#{student.phoneNumber}" />
</p:column>
<p:column id="stdentAddrs" headerText="Address" filterBy="#{student.address}" filterStyle="display:none">
<h:outputText value="#{student.address}" />
</p:column>
<p:column id="stdentCountry" headerText="Country" filterBy="#{student.country}" filterStyle="display:none">
<h:outputText value="#{student.country}" />
</p:column>
<p:column id="stdentJOD" headerText="Joining Date" filterBy="#{student.dateOfJoining}" filterStyle="display:none">
<h:outputText value="#{student.dateOfJoining}" />
</p:column>
<p:column id="stdentGenralRmrks" headerText="General Remarks" filterBy="#{student.generalRemarks}" filterStyle="display:none">
<h:outputText value="#{student.generalRemarks}" />
</p:column>
<p:column id="studentStatus" headerText="Student Status" filterBy="#{student.studentStatus}" filterStyle="display:none">
<h:outputText value="#{student.studentStatus}" />
</p:column>
</p:dataTable>
</p:dialog>
<p:dialog id="editStdentDlg" header="Edit Student" widgetVar="editStudentDialog" modal="true">
<p:outputPanel id="stdDetail" style="text-align:center;">
<p:outputLabel value="First Name *" />
<p:inputText value="#{viewStudentsBean.selectedStudent.lastName}"/>
<p:panelGrid id="editStdPanelGrd" columns="2" cellpadding="5" style="width: 100%;">
<p:outputLabel value="First Name *" />
<p:inputText id="stdEditFname" value="#{viewStudentsBean.selectedStudent.firstName}"/>
<p:outputLabel value="Last Name *" />
<p:inputText id="stdEditLastname" value="#{viewStudentsBean.selectedStudent.lastName}"/>
<p:outputLabel value="Father's Name *" />
<p:inputText id="stdEditFathName" value="#{viewStudentsBean.selectedStudent.fatherName}"/>
<p:outputLabel value="Gender *" />
<h:selectOneMenu id="stdEditGnder" value="#{viewStudentsBean.selectedStudent.gender}">
<f:selectItem itemValue="Male" itemLabel="Male" />
<f:selectItem itemValue="Female" itemLabel="Female" />
</h:selectOneMenu>
<p:outputLabel value="Date Of Birth *" />
<p:calendar id="stdEditDOB" value="#{viewStudentsBean.selectedStudent.dob}"/>
<p:outputLabel value="Skype Id/Email *" />
<p:inputText id="stdEditSkype" value="#{viewStudentsBean.selectedStudent.skypeOrEmailId}"/>
<p:outputLabel value="Phone No *" />
<p:inputText id="stdEditPNo" value="#{viewStudentsBean.selectedStudent.phoneNumber}"/>
<p:outputLabel value="Address *" />
<p:inputText id="stdEditAddrs" value="#{viewStudentsBean.selectedStudent.address}"/>
<p:outputLabel value="Country *" />
<p:inputText id="stdEditCountry" value="#{viewStudentsBean.selectedStudent.country}"/>
<p:outputLabel value="Date of joining *" />
<p:calendar id="stdEditDOJ" value="#{viewStudentsBean.selectedStudent.dateOfJoining}"/>
<p:outputLabel value="General Remarks" />
<p:inputText id="stdEditGR" value="#{viewStudentsBean.selectedStudent.generalRemarks}"/>
</p:panelGrid>
</p:outputPanel>
</p:dialog>
<p:dialog id="editStdentStatusDlg" header="Edit Student" widgetVar="editStudentStatusDialog" modal="true">
<p:outputPanel id="stdStatusDetail" style="text-align:center;">
The current status of:<p:outputLabel value="#{viewStudentsBean.selectedStudent.lastName}"/>
is: <p:outputLabel value="#{viewStudentsBean.selectedStudent.studentStatus}" />
</p:outputPanel>
</p:dialog>
</h:form>
PS: I am using JSF 2.2 with PrimeFaces 5.0
I am absolutely stuck here. Any help would be greatly appreciated
Found the solution. Actually the second dialog in which i wanted to display/edit the selection object binded to p:datatable, required to be updated in context menu like:
update=":searchStdentsForm:editStdentDlg"
means the form and dialog needed to be explicitly referred.
I am using PrimeFaces but I have problem with display <p:messages> for converterMessage.
When I use JSF tag <h:message>, it works correctly or even when I insert it into columns, but when I change to <p:message> it does not show. Can anybody helps me? My page is:
<h:form id="form2" prependId="false" style="direction:rtl;width: 600;top: 300px ;position: absolute" >
<p:messages for="count"/>
<p:outputLabel value="sum credit :#{shoppingBean.sumcredit}"/><br/>
<p:outputLabel value="shopping list :"/>
<p:dataTable id="dataTbl2" var="selectedProduct" value="#{shoppingBean.selectedProduct}" emptyMessage="no data"
paginatorAlwaysVisible="true" selection="#{shoppingBean.selection2}"
rowKey="#{selectedProduct.id}" disabledSelection="false" rows="5" paginator="true" pageLinks="5">
<p:column style="color: blue">
<f:facet name="header">
<h:outputText value="brand" />
</f:facet>
<h:outputText value="#{selectedProduct.tblShopProduct.brand}" />
</p:column>
<p:column style="color: blue">
<f:facet name="header">
<h:outputText value="price" />
</f:facet>
<h:outputText value="#{selectedProduct.tblShopProduct.price}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="date" />
</f:facet>
<h:outputText value="#{shoppingBean.tblShopOrder.created.toString().substring(0,11)}" />
<h:outputText value="#{shoppingBean.tblShopOrder.created.toString().substring(11,19)}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="number" />
</f:facet>
<h:outputText value="#{selectedProduct.number}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="amount" />
</f:facet>
<h:outputText value="#{selectedProduct.amount}" />
</p:column>
<p:column style="color: blue">
<f:facet name="header">
<h:outputText value="edit"/>**<h:inputText id="count" converterMessage="you allowed only for using number value="#{shoppingBean.count}"/>**
</f:facet>
<h:commandButton value="sum" rendered="#{selectedProduct.number==null}" action="#{shoppingBean.addProductCount(selectedProduct)}" />
<h:commandButton value="confirm" disabled="true" rendered="#{selectedProduct.number!=null}" />
</p:column>
<p:column style="color: blue" >
<f:facet name="header">
<h:outputText value="delete" />
</f:facet>
<h:commandButton value="delete" action="#{shoppingBean.deleteBuyed(selectedProduct)}" />
</p:column>
<f:facet name="footer">
<h:commandButton value="final shopping" action="#{shoppingBean.finalShop(selectedProduct)}" />
</f:facet>
</p:dataTable>
</h:form>
Tohid Makari.
<h:outputText value="edit"/>**<h:inputText id="count" converterMessage="you allowed only for using number value="#{shoppingBean.count}"/>**
This line could not work. Fix this first.
You do not update your messages tag.
Try something like this :
<p:messages for="count" autoUpdate="true" />
Ok, this issue is driving me nuts....
I've got this xhtml page, with 2 dialogs...
both dialogs has a form inside to send a submit to the server, they work fine, but when they are called and updated from a commandLink form, actionListener from dialog form just doesn't work, any ideas?
this is the menu where I call the dialogs
<ui:define name="left">
<h:form id="menuForm">
<div class="sidebar-nav">
<div class="well" style="width:150px; padding: 8px 0;">
<ul class="nav nav-list">
<li class="text-center">Options</li>
<li><p:commandLink id="createLink" update=":LocationCreateForm" actionListener="#{locationController.prepareCreate}" oncomplete="LocationCreateDialog.show()"><span class="glyphicon glyphicon-user"></span> Create New</p:commandLink> </li>
<li><p:commandLink id="editLink" update=":LocationEditForm" oncomplete="LocationEditDialog.show()"><span class="glyphicon glyphicon-edit"></span> Update</p:commandLink> </li>
<li><p:commandLink id="deleteLink" actionListener="#{locationController.delete}"><span class="glyphicon glyphicon-ban-circle"></span> Delete</p:commandLink> </li>
</ul>
</div>
</div>
</h:form>
</ui:define>
if I remove the update from commandLink they work, but for edit dialog I can't get the information to edit.
where the dialogs and list are:
<ui:define name="content">
<h1>Locations</h1>
<!-- Location List -->
<h:form id="LocationListForm">
<p:dataTable id="datalist" value="#{locationController.items}" var="item"
selectionMode="single" selection="#{locationController.selected}"
rowKey="#{item.id}"
>
<p:column sortBy="#{item.id}" filterBy="#{item.id}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_id}"/>
</f:facet>
<h:outputText value="#{item.id}"/>
</p:column>
<p:column sortBy="#{item.name}" filterBy="#{item.name}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_name}"/>
</f:facet>
<h:outputText value="#{item.name}"/>
</p:column>
<p:column sortBy="#{item.openingHourMonday}" filterBy="#{item.openingHourMonday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourMonday}"/>
</f:facet>
<h:outputText value="#{item.openingHourMonday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourTuesday}" filterBy="#{item.openingHourTuesday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourTuesday}"/>
</f:facet>
<h:outputText value="#{item.openingHourTuesday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourWednesday}" filterBy="#{item.openingHourWednesday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourWednesday}"/>
</f:facet>
<h:outputText value="#{item.openingHourWednesday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourThrusday}" filterBy="#{item.openingHourThrusday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourThrusday}"/>
</f:facet>
<h:outputText value="#{item.openingHourThrusday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourFriday}" filterBy="#{item.openingHourFriday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourFriday}"/>
</f:facet>
<h:outputText value="#{item.openingHourFriday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourSaturday}" filterBy="#{item.openingHourSaturday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourSaturday}"/>
</f:facet>
<h:outputText value="#{item.openingHourSaturday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
<p:column sortBy="#{item.openingHourSunday}" filterBy="#{item.openingHourSunday}">
<f:facet name="header">
<h:outputText value="#{myBundle.ListLocationTitle_openingHourSunday}"/>
</f:facet>
<h:outputText value="#{item.openingHourSunday}">
<f:convertDateTime pattern="HH:mm:ss" />
</h:outputText>
</p:column>
</p:dataTable>
</h:form>
<!-- Location Create Dialog -->
<p:dialog id="LocationCreateDlg" widgetVar="LocationCreateDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.CreateLocationTitle}">
<h:form id="LocationCreateForm">
<h:panelGroup id="display">
<p:panelGrid columns="2" >
<p:outputLabel value="#{myBundle.CreateLocationLabel_name}" for="name" />
<p:inputText id="name" value="#{locationController.selected.name}" title="#{myBundle.CreateLocationTitle_name}" required="true" requiredMessage="#{myBundle.CreateLocationRequiredMessage_name}"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourMonday}" for="openingHourMonday" />
<p:calendar id="openingHourMonday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourMonday}" title="#{myBundle.EditLocationTitle_openingHourMonday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourMonday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourTuesday}" for="openingHourTuesday" />
<p:calendar id="openingHourTuesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourTuesday}" title="#{myBundle.EditLocationTitle_openingHourTuesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourTuesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourWednesday}" for="openingHourWednesday" />
<p:calendar id="openingHourWednesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourWednesday}" title="#{myBundle.EditLocationTitle_openingHourWednesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourWednesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourThrusday}" for="openingHourThrusday" />
<p:calendar id="openingHourThrusday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourThrusday}" title="#{myBundle.EditLocationTitle_openingHourThrusday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourThrusday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourFriday}" for="openingHourFriday" />
<p:calendar id="openingHourFriday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourFriday}" title="#{myBundle.EditLocationTitle_openingHourFriday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourFriday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourSaturday}" for="openingHourSaturday" />
<p:calendar id="openingHourSaturday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSaturday}" title="#{myBundle.EditLocationTitle_openingHourSaturday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSaturday}" showOn="button"/>
<p:outputLabel value="#{myBundle.CreateLocationLabel_openingHourSunday}" for="openingHourSunday" />
<p:calendar id="openingHourSunday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSunday}" title="#{myBundle.EditLocationTitle_openingHourSunday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSunday}" showOn="button"/>
</p:panelGrid>
<p:commandButton actionListener="#{locationController.saveNew}" value="#{myBundle.Save}" update="display,:LocationListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,LocationCreateDialog);"/>
<p:commandButton value="#{myBundle.Cancel}" onclick="LocationCreateDialog.hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
<!-- Location Update Dialog -->
<p:dialog id="LocationEditDlg" widgetVar="LocationEditDialog" modal="true" resizable="false" appendToBody="true" header="#{myBundle.EditLocationTitle}">
<h:form id="LocationEditForm">
<h:panelGroup id="display">
<p:panelGrid columns="2" rendered="#{locationController.selected != null}">
<h:outputLabel value="#{myBundle.EditLocationLabel_id}" for="id" />
<h:outputText id="id" value="#{locationController.selected.id}" />
<p:outputLabel value="#{myBundle.EditLocationLabel_name}" for="name" />
<p:inputText id="name" value="#{locationController.selected.name}" title="#{myBundle.EditLocationTitle_name}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_name}"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourMonday}" for="openingHourMonday" />
<p:calendar id="openingHourMonday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourMonday}" title="#{myBundle.EditLocationTitle_openingHourMonday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourMonday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourTuesday}" for="openingHourTuesday" />
<p:calendar id="openingHourTuesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourTuesday}" title="#{myBundle.EditLocationTitle_openingHourTuesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourTuesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourWednesday}" for="openingHourWednesday" />
<p:calendar id="openingHourWednesday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourWednesday}" title="#{myBundle.EditLocationTitle_openingHourWednesday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourWednesday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourThrusday}" for="openingHourThrusday" />
<p:calendar id="openingHourThrusday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourThrusday}" title="#{myBundle.EditLocationTitle_openingHourThrusday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourThrusday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourFriday}" for="openingHourFriday" />
<p:calendar id="openingHourFriday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourFriday}" title="#{myBundle.EditLocationTitle_openingHourFriday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourFriday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourSaturday}" for="openingHourSaturday" />
<p:calendar id="openingHourSaturday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSaturday}" title="#{myBundle.EditLocationTitle_openingHourSaturday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSaturday}" showOn="button"/>
<p:outputLabel value="#{myBundle.EditLocationLabel_openingHourSunday}" for="openingHourSunday" />
<p:calendar id="openingHourSunday" pattern="HH:mm:ss" value="#{locationController.selected.openingHourSunday}" title="#{myBundle.EditLocationTitle_openingHourSunday}" required="true" requiredMessage="#{myBundle.EditLocationRequiredMessage_openingHourSunday}" showOn="button"/>
</p:panelGrid>
<p:commandButton actionListener="#{locationController.save}" value="#{myBundle.Save}" update="display,:LocationListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,LocationEditDialog);"/>
<p:commandButton value="#{myBundle.Cancel}" onclick="LocationEditDialog.hide();"/>
</h:panelGroup>
</h:form>
</p:dialog>
</ui:define>
Use process = "#this" in p:commandButton and appendTo="#(body)"in p:dialog
solved issue, updated to primefaces 4.0 RC1, changed appendToBody="true", to appendTo="#(body)"