I am trying to use dataScroller to show elements of a database table. It shows all the elements correctly but when I try to use some actions it only works for the last element like:
<p:commandButton value="vote"
action="#{avisBean.updateAvis(in,email)}">
and
<p:commandButton value="commenter" icon="ui-icon-check"
action="#{avisBean.addAvis(in,email)}">`
and for the others nothings enters to the database just empty string. How can I correct this?
This is the code:
<h:form id="commandLink">
<p:dataScroller value="#{ideeBean.idees}" var="in" chunkSize="10"
mode="inline" scrollHeight="500">
<f:facet name="header">
Les Idées
</f:facet>
<h:panelGrid columns="1" style="width:100%"
columnClasses="logo,detail">
<!-- <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" /> -->
<p:outputPanel>
<h:panelGrid columns="2" cellpadding="5">
<h:outputText value="#{msg['idee.titre']}" />
<h:outputText value="#{in.titre}" style="font-weight: bold" />
<h:outputText value="#{msg['idee.description']}" />
<h:outputText value="#{in.description}"
style="font-weight: bold" />
<h:outputText value="#{msg['idee.theme']}" />
<h:outputText value="#{in.theme}" style="font-weight: bold" />
<h:outputText value="#{msg['idee.type']}" />
<h:outputText value="#{in.type}" style="font-weight: bold" />
<!-- *******************Rating**************** -->
</h:panelGrid>
</p:outputPanel>
<h:panelGrid columns="4" cellpadding="5">
<p:commandButton value="details"
action="details?faces-redirect=true"
actionListener="#{ideeBean.attrListener}">
<f:attribute name="idee" value="#{in}" />
</p:commandButton>
<!--************************************** -->
<p:selectOneMenu id="console" value="#{avisBean.avis.score}"
style="width:125px" converter="javax.faces.Integer">
<f:convertNumber integerOnly="true" />
<f:selectItem itemLabel="Choisir" itemValue="" />
<f:selectItem itemLabel="Horrible" itemValue="1" />
<f:selectItem itemLabel="médiocre" itemValue="2" />
<f:selectItem itemLabel="Bon" itemValue="3" />
<f:selectItem itemLabel="Trés Bon" itemValue="4" />
<f:selectItem itemLabel="Excellent" itemValue="5" />
</p:selectOneMenu>
<p:commandButton value="vote"
action="#{avisBean.updateAvis(in,email)}">
</p:commandButton>
</h:panelGrid>
<!-- ***************************comments******************** -->
<p:dataScroller id="growl"
value="#{ideeBean.getAllAvisList(in.id)}" var="a" chunkSize="2">
<f:facet name="header">
commentaires
</f:facet>
<f:facet name="loader">
<p:commandButton type="button" value="Plus"
icon="ui-icon-circle-triangle-s" />
</f:facet>
<h:panelGrid columns="1">
<!-- <p:graphicImage name="demo/images/car/#{car.brand}-big.gif" /> -->
<p:outputPanel>
<h:panelGrid columns="4" cellpadding="5">
<h:outputText value="#{a.user_avis.nom}" />
<p:inplace id="ajax" editor="true">
<p:ajax event="save" listener="#{avisBean.updateAvis(a)}" />
<h:inputText value="#{a.commentaire}"
style="font-weight: bold" rendered="#{not empty a.commentaire}" />
</p:inplace>
<p:commandButton value="Supprimer"
action="#{ideeBean.deleteAvisById(in.id,a.id)}"
icon="ui-icon-arrowrefresh-1-w"
rendered="#{utilisateurBean.getAllAvis(a,userid)}">
<f:param name="userid" value="#{loginBean.id}"></f:param>
</p:commandButton>
</h:panelGrid>
</p:outputPanel>
</h:panelGrid>
</p:dataScroller>
<!-- ***************************************** -->
<h:panelGrid columns="1">
<p:inputTextarea rows="2" cols="50" id="comment"
value="#{avisBean.avis.commentaire}" />
<p:commandButton value="commenter" icon="ui-icon-check"
action="#{avisBean.addAvis(in,email)}">
<f:param name="email" value="#{loginBean.email}"></f:param>
</p:commandButton>
</h:panelGrid>
<h:panelGrid columns="1" style="width:100%">
<p:graphicImage value="resources/images/separateurr.png" />
</h:panelGrid>
</h:panelGrid>
</p:dataScroller>
</h:form>
Related
I have primefaces datatable. The paginator is fixed to the bottom of the window. To achieve this I have manipulated the original css selector which you can see below. I would like to achieve that only the table rows are scrolling. The table header and the paginator should stay as they are.
Datatable View
<p:dataTable
id="dtaInternationalization"
binding="#{internationalizationController.dtaHdrLang}"
value="#{internationalizationController.itemsHdrLang}"
var="item"
widgetVar="widInternationalization"
style="margin-bottom:20px"
selectionMode="multiple"
liveScroll="true"
scrollable="true"
scrollHeight="665"
selection="#{internationalizationController.selectedItemsHdrLang}"
filteredValue="#{internationalizationController.filteredItemsHdrLang}"
sortMode="multiple"
paginator="true"
paginatorPosition="bottom"
paginatorAlwaysVisible="true"
rows="25"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
currentPageReportTemplate="{totalRecords} record(s)"
rowsPerPageTemplate="25,50,75"
rowKey="#{item.pk}"
resizableColumns="true"
liveResize="true"
draggableColumns="true">
<!-- DATATABLE HEADER SECTION -->
<f:facet name="header">
<p:toolbar styleClass="fw-panel-title-header">
<p:toolbarGroup styleClass="fw-toolbar-group-left">
<p:outputLabel id="lblPageTitle"
value="Edit Datatable Settings" styleClass="fw-title-bar" />
</p:toolbarGroup>
<p:toolbarGroup styleClass="fw-toolbar-group-right">
<p:outputLabel value="Global Search: "
styleClass="fw-global-search" />
<p:inputText id="globalFilter"
onkeyup="PF('widTableView').filter()" style="width:250px"
placeholder="Enter Keyword" />
</p:toolbarGroup>
<p:toolbarGroup styleClass="fw-toolbar-group-right">
<p:commandButton id="cbProperties" icon="fa fa-gear" title="View Settings" />
<p:commandButton id="refreshButton" value="Refresh"
icon="fa fa-refresh"
actionListener="#{internationalizationController.refresh}"
update="dtaInternationalization" />
<p:commandButton id="addButton" value="Add" icon="fa fa-plus"
actionListener="#{internationalizationController.addLanguage}"
oncomplete="PF('widAddLanguage').show()" />
<p:commandButton id="deleteButton" value="Delete"
icon="fa fa-remove"
disabled="#{empty internationalizationController.selectedItemsHdrLang}" />
</p:toolbarGroup>
<p:toolbarGroup styleClass="fw-toolbar-group-right">
<p:ajaxStatus
style="width:20px;height:20px;position:relative;margin-right:15px;">
<f:facet name="start">
<i class="fa fa-circle-o-notch fa-spin ajax-loader"
aria-hidden="true"></i>
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</p:toolbarGroup>
<p:toolbarGroup styleClass="fw-toolbar-group-right"
style="margin-right:15px">
<p:messages id="msgs" showDetail="true" closable="false" styleClass="fw-messages-title-bar" showSummary="false" showIcon="false" />
</p:toolbarGroup>
</p:toolbar>
</f:facet>
<!-- DATATABLE COLUMN SECTION -->
<p:column headerText="Image" styleClass="center" width="50">
<o:graphicImage value="#{item.flagImageSmall}" dataURI="true"
rendered="#{!empty item.flagImageSmall}" />
</p:column>
<p:column headerText="Default" styleClass="center"
filterBy="#{item.languageDefault}" filterMatchMode="equals"
sortBy="#{item.languageDefault}" width="110">
<f:facet name="filter">
<p:selectOneButton
onchange="PF('widInternationalization').filter()"
styleClass="custom-filter">
<f:converter converterId="javax.faces.Boolean" />
<f:selectItem itemLabel="All" itemValue="" />
<f:selectItem itemLabel="True" itemValue="true" />
<f:selectItem itemLabel="False" itemValue="false" />
</p:selectOneButton>
</f:facet>
<p:outputLabel rendered="#{item.languageDefault}">
<i class="fa fa-check" />
</p:outputLabel>
</p:column>
<p:column headerText="Active" styleClass="center"
filterBy="#{item.activeFlag}" filterMatchMode="equals"
sortBy="#{item.activeFlag}" width="110">
<f:facet name="filter">
<p:selectOneButton
onchange="PF('widInternationalization').filter()"
styleClass="custom-filter">
<f:converter converterId="javax.faces.Boolean" />
<f:selectItem itemLabel="All" itemValue="" />
<f:selectItem itemLabel="True" itemValue="true" />
<f:selectItem itemLabel="False" itemValue="false" />
</p:selectOneButton>
</f:facet>
<p:outputLabel rendered="#{item.activeFlag}">
<i class="fa fa-check" />
</p:outputLabel>
</p:column>
<p:column headerText="Code" styleClass="center" width="90"
filterBy="#{item.languageCode}" filterMatchMode="contains"
sortBy="#{item.languageCode}">
<h:outputText value="#{item.languageCode}" />
</p:column>
<p:column headerText="Language" filterBy="#{item.languageName}"
filterMatchMode="contains" sortBy="#{item.languageName}">
<h:outputText value="#{item.languageName}" />
</p:column>
<p:column headerText="Created" filterBy="#{item.createDate}"
filterMatchMode="contains" sortBy="#{item.createDate}" width="6%">
<h:outputText value="#{item.createDate}">
<f:convertDateTime
locale="#{parameterSessionController.localeCode}" type="localDateTime"
dateStyle="medium" timeStyle="medium" />
</h:outputText>
</p:column>
<p:column headerText="Created by" filterBy="#{item.createUser}"
filterMatchMode="contains" sortBy="#{item.createUser}" width="6%">
<h:outputText value="#{item.createUser}" />
</p:column>
<p:column headerText="Modified" filterBy="#{item.modifyDate}"
filterMatchMode="contains" sortBy="#{item.modifyDate}" width="6%">
<h:outputText value="#{item.modifyDate}">
<f:convertDateTime
locale="#{parameterSessionController.localeCode}" type="localDateTime"
dateStyle="medium" timeStyle="medium" />
</h:outputText>
</p:column>
<p:column headerText="Modfied by" filterBy="#{item.modifyUser}"
filterMatchMode="contains" sortBy="#{item.modifyUser}" width="6%">
<h:outputText value="#{item.modifyUser}" />
</p:column>
<p:ajax event="rowDblselect"
listener="#{internationalizationController.editLanguage}"
oncomplete="PF('widLanguage').show()" />
<p:ajax event="rowSelect" update="deleteButton" />
<p:ajax event="rowUnselect" update="deleteButton" />
</p:dataTable>
The paginator css selectorI have manipulated as follow:
body .ui-datatable .ui-paginator {
padding: 6px 12px;
border-style: none;
border-top: solid 2px #9fd037;
position: fixed;
bottom: 0px;
width: -webkit-fill-available;
z-index: 1;
}
Many Thanks in Advance
i have two p:commandLink:
<p:commandLink update=":form:livreDetail" oncomplete="PF('livreDialog').show()" title="View Detail">
<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" />
<f:setPropertyActionListener value="#{livre}" target="#{livreDataGridView.selectedLivre}" />
</p:commandLink>
<p:commandLink update=":form:ajoutPanel" oncomplete="if(#{ empty loginBean.c }){PF('connectDialog').show()}else {PF('ajoutLivrePanier').show()} " title="ajouter au panier">
<h:outputText styleClass="ui-icon ui-icon-cart" style="margin:0 auto;" />
<f:setPropertyActionListener value="#{livre}" target="#{livreDataGridView.selectedLivre}" />
</p:commandLink>
The first p:commandLink one is showing and updating the content of livreDialog p:dialog.
The second p:commandLink should show connectDialog p:dialog when loginBean.c property is null, and ajoutLivrePanier p:dialog when is not.
my code works correctly when the loginBean property is null. But when is not it gives strange results:
When i click the first p:commandLink it only shows the livreDialog p:dialog without updating it's content. Also the validation message of the connectDialog p:dialog is shown up. it is weird !!
When i click the second p:commandLink only the validation message of connectDialog p:dialog is shown up, Weird too !!
Here is the hole code:
<p:messages globalOnly="true" autoUpdate="true" showDetail="false"/>
<h:form id="form">
<p:dataGrid var="livre" value="#{livreListBean.livresList}" columns="3"
rows="12" paginator="true" id="livres"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="6,12,16">
<f:facet name="header">
Livres
</f:facet>
<p:panel header="#{livre.titre}" style="text-align:center">
<h:panelGrid columns="1" style="width:100%">
<h:outputText value="#{livre.auteur}" />
<h:outputText value="#{livre.datePublication}" />
<p:commandLink update=":form:livreDetail" oncomplete="PF('livreDialog').show()" title="View Detail">
<h:outputText styleClass="ui-icon ui-icon-search" style="margin:0 auto;" />
<f:setPropertyActionListener value="#{livre}" target="#{livreDataGridView.selectedLivre}" />
</p:commandLink>
<p:commandLink update=":form:ajoutPanel" oncomplete="if(#{ empty loginBean.c }){PF('connectDialog').show()}else {PF('ajoutLivrePanier').show()} " title="ajouter au panier">
<h:outputText styleClass="ui-icon ui-icon-cart" style="margin:0 auto;" />
<f:setPropertyActionListener value="#{livre}" target="#{livreDataGridView.selectedLivre}" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:dataGrid>
<p:dialog header="Info Livre" widgetVar="livreDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel id="livreDetail" style="text-align:center;">
<p:panelGrid columns="2" rendered="#{not empty livreDataGridView.selectedLivre}" columnClasses="label,value">
<h:outputText value="Titre:" />
<h:outputText value="#{livreDataGridView.selectedLivre.titre}" />
<h:outputText value="Auteur" />
<h:outputText value="#{livreDataGridView.selectedLivre.auteur}" />
<h:outputText value="Date de publication:" />
<h:outputText value="#{livreDataGridView.selectedLivre.datePublication}" />
<h:outputText value="Prix" />
<h:outputText value="$#{livreDataGridView.selectedLivre.prix}" />
</p:panelGrid>
</p:outputPanel>
</p:dialog>
<h:panelGroup id="livrePanier">
<p:dialog header="Se connecter" widgetVar="connectDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel id="connecterPanel" style="text-align:center;">
<h:panelGrid columns="3" >
<p:outputLabel for="mail" value="E-mail:" />
<p:inputText id="mail" value="#{loginBean.email}" required="true" requiredMessage="Vous devez entrer votre e-mail"/>
<p:message for="mail"/>
<p:outputLabel for="password" value="Password:" />
<p:password id="password" value="#{loginBean.password}" required="true" requiredMessage="Vous devez entrer votre password"/>
<p:message for="password"/>
<p:commandButton value="Se connecter" action="#{loginBean.LoginProcess()}" process="connecterPanel" update="connecterPanel"/>
</h:panelGrid>
</p:outputPanel>
</p:dialog>
<p:dialog header="Ajouter au panier" widgetVar="ajoutLivrePanier" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel id="ajoutPanel" style="text-align:center;" rendered="#{not empty livreDataGridView.selectedLivre}">
<p:outputLabel value="Voulez vous ajouter ce produit au panier ?"/>
<h:panelGrid columns="2" >
<p:outputLabel value="#{livreDataGridView.selectedLivre.titre}" />
<p:outputLabel value="#{livreDataGridView.selectedLivre.prix}" />
<p:commandButton value="Oui" action="#{livreDataGridView.ajouterLivreAuPanier()}" process="connecterPanel" update="connecterPanel" oncomplete="PF('ajoutLivrePanier').hide()"/>
<p:commandButton value="Annuler" onclick="PF('ajoutLivrePanier').hide()"/>
</h:panelGrid>
</p:outputPanel>
</p:dialog>
</h:panelGroup>
</h:form>
i'll appreciate your help to fix the problem
You need process="#this" on your commandLinks. Without it JSF processes the whole form, that's why you see those validation failures, which in turn cause the Invoke Application phase to be skipped.
See also: Understanding PrimeFaces process/update and JSF f:ajax execute/render attributes.
I have a PrimeFaces dataTable with buttons at the footer for creating, editing and deleting records from the table.
A click on the Create and Edit button displays a modal dialog to carry out each task. During a create or Edit, the dialog is not dismissed but rather an Ajax update is done so that as many record as possible can be inserted or edit can be repeatedly done. But the issue now is, after any Ajax Update datepickers gets disabled and TextArea counters disappears. Code sample is available below:
<ui:define name="metadata">
<f:metadata>
<f:event listener="#{departmentController.retrieveDeptList}"
type="preRenderView"/>
</f:metadata>
</ui:define>
<ui:define name="title">
<h:outputText value="#{bundle.ListDepartmentTitle}" />
</ui:define>
<ui:define name="mainContent">
<!--main content start-->
<section id="main-content">
<section class="wrapper">
<h3><i class="fa fa-angle-right"></i> #{bundle.ListDepartmentMainTableTitle}</h3>
<div class="row">
<div class="col-md-12">
<div class="content-panel">
<h:form id="DepartmentListForm">
<h:panelGroup id="results" styleClass="table-responsive">
<p:spacer width="10"/>
<h:outputText id="informationMessage"
value="#{departmentController.infoMessage}"
rendered="#{departmentController.infoMessage ne null}"
styleClass="informationMessage"/>
<p:dataTable id="datalist"
value="#{departmentController.items}"
var="item"
tableStyleClass="table"
selectionMode="single"
selection="#{departmentController.newDept}"
paginator="true"
scrollable="true"
scrollHeight="250"
rowKey="#{item.deptId}"
rows="10"
rowsPerPageTemplate="10,20,30,40,50"
emptyMessage="No department results found" >
<p:ajax event="rowSelect"
listener="#{departmentController.onRowSelect}"
update="createButton editButton deleteButton viewMemButton"/>
<p:ajax event="rowUnselect"
listener="#{departmentController.onRowUnselect}"
update="createButton editButton deleteButton viewMemButton"/>
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle['ListDepartmentTitle_deptName']}"/>
</f:facet>
<h:outputText value="#{item.deptName}"/>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{bundle['ListDepartmentTitle_dateEstablished']}"/>
</f:facet>
<h:outputText value="#{item.dateEstablished}">
<f:convertDateTime pattern="dd.MMM.yyyy" />
</h:outputText>
</p:column>
<f:facet name="footer">
<p:commandButton id="createButton"
icon="ui-icon-plus"
value="#{bundle['Create']}"
actionListener="#{departmentController.prepareCreate}"
oncomplete="PF('DepartmentCreateDialog').show()"/>
<p:spacer width="10"/>
<p:commandButton id="editButton"
process="#form"
icon="ui-icon-pencil"
value="#{bundle.Edit}"
update=":DepartmentEditForm"
oncomplete="PF('DepartmentEditDialog').show()"
disabled="#{departmentController.selectedDept eq null}" />
<p:spacer width="10"/>
<p:commandButton id="deleteButton"
icon="ui-icon-trash"
process="#form"
value="#{bundle.Delete}"
action="#{parishOfficesController.destroy}"
update=":growl, :DepartmentListForm:results"
disabled="#{departmentController.selectedDept eq null}">
<p:confirm header="Confirmation"
message="Are you sure you want to delete?"
icon="ui-icon-alert" />
</p:commandButton>
<p:confirmDialog global="true"
showEffect="fade"
styleClass="text-center"
hideEffect="fade">
<p:commandButton value="Yes" type="button"
styleClass="ui-confirmdialog-yes"
icon="ui-icon-check" />
<p:commandButton value="No" type="button"
styleClass="ui-confirmdialog-no"
icon="ui-icon-close" />
</p:confirmDialog>
<p:spacer width="30"/>
<p:commandButton id="viewMemButton"
value="#{bundle.ViewMembers}"
icon="ui-icon-extlink"
actionListener="#{dfView.chooseDepartment}"
disabled="#{departmentController.selectedDept eq null}" >
<p:ajax event="dialogReturn"
listener="#{dfView.onDeptMemberChosen}"
update=":growl" />
</p:commandButton>
</f:facet>
</p:dataTable>
</h:panelGroup>
<h:messages id="messages" styleClass="errorMessage"/>
</h:form>
<ui:include src="addDept.xhtml"/>
<ui:include src="editDept.xhtml"/>
</div>
</div>
</div>
</section>
</section><!-- /MAIN CONTENT -->
</ui:define>
//---------------------------------------------------------------------------
<p:dialog id="DepartmentEditDlg"
widgetVar="DepartmentEditDialog"
modal="true"
resizable="false"
appendTo="#(body)"
closable="false"
width="400"
height="300"
header="#{bundle['EditDepartmentTitle']}">
<h:form id="DepartmentEditForm" prependId="false">
<h:panelGroup id="editDisplay">
<p:messages id="editMsg" globalOnly="true" closable="true">
<p:effect type="pulsate" event="load" delay="500" />
</p:messages>
<br/>
<div class="form-group">
<h:outputLabel styleClass="labelText"
value="#{bundle.EditDepartmentLabel_deptName}"
for="editDeptName" />
<h:inputText id="editDeptName"
value="#{departmentController.newDept.deptName}"
title="#{bundle.EditParishOfficesTitle_deptName}"
required="true"
styleClass="form-control"
requiredMessage="#{bundle.EditDepartmentRequiredMessage_deptName}"/>
<h:message id="DeptEditMsg"
styleClass="errorMessage"
for="editDeptName"
showDetail="true"/>
</div>
<div class="form-group">
<h:outputLabel styleClass="labelText"
value="#{bundle.EditDepartmentLabel_dateEstablished}"
for="editDateEstablished" />
<b:datepicker id="editDateEstablished"
showButtonPanel="true"
change-month="true"
placeholder="Select a Date"
change-year="true"
value="#{departmentController.newDept.dateEstablished}"/>
</div>
<!--
<div>
<h:outputLabel styleClass="labelText"
value="#{bundle.EditDepartmentLabel_dateEstablished}"
for="editDateEstablished" />
</div>
<div>
<p:calendar id="editDateEstablished"
readonlyInput="true"
navigator="true"
mode="popup"
showButtonPanel="true"
pattern="dd.MMM.yyyy"
value="#{departmentController.newDept.dateEstablished}"
title="#{bundle.EditDepartmentTitle_dateEstablished}"
showOn="button"/>
</div>
-->
<br/>
<div class="modal-footer">
<p:commandButton actionListener="#{departmentController.update}"
value="#{bundle.Save}"
update="editDisplay,
:growl, :DepartmentListForm:results,
:DepartmentListForm:messages" />
<p:spacer width="10"/>
<p:commandButton value="#{bundle.Cancel}"
process=":DepartmentListForm"
action="#{departmentController.cancel}"
ajax="false"
onclick="DepartmentEditDialog.hide()"
update=":DepartmentListForm:results"
immediate="true" />
</div>
</h:panelGroup>
</h:form>
</p:dialog>
//--------------------------------------------------------------------------
<p:dialog id="DepartmentCreateDlg"
widgetVar="DepartmentCreateDialog"
modal="true"
resizable="false"
appendTo="#(body)"
closable="false"
width="400"
height="300"
header="#{bundle['CreateDepartmentTitle']}">
<h:form id="DepartmentCreateForm" prependId="false">
<h:panelGroup id="display">
<p:messages id="createMsg" globalOnly="true" closable="true">
<p:effect type="pulsate" event="load" delay="500" />
</p:messages>
<br/>
<div class="form-group">
<h:outputLabel styleClass="labelText"
value="#{bundle['CreateDepartmentLabel_deptName']}"
for="deptName" />
<h:inputText id="deptName"
styleClass="form-control"
value="#{departmentController.newDept.deptName}"
title="#{bundle['CreateDepartmentTitle_deptName']}"
required="true"
requiredMessage="#{bundle['CreateDepartmentRequiredMessage_deptName']}"/>
<h:message id="deptNameMsg"
styleClass="errorMessage"
for="deptName"
showDetail="true"/>
</div>
<div class="form-group">
<h:outputLabel styleClass="labelText"
value="#{bundle['CreateDepartmentLabel_dateEstablished']}"
for="dateEstablished" />
<b:datepicker id="dateEstablished"
showButtonPanel="true"
change-month="true"
placeholder="Select a Date"
change-year="true"
value="#{departmentController.newDept.dateEstablished}"/>
</div>
<!--
<div>
<h:outputLabel styleClass="labelText"
value="#{bundle['CreateDepartmentLabel_dateEstablished']}"
for="dateEstablished" />
</div>
<div>
<p:calendar id="dateEstablished"
readonlyInput="true"
navigator="true"
mode="popup"
showButtonPanel="true"
showOn="button"
pattern="dd.MMM.yyyy"
value="#{departmentController.newDept.dateEstablished}"
title="#{bundle['CreateDepartmentTitle_dateEstablished']}" />
</div>
-->
<br/>
<div class="modal-footer">
<p:commandButton actionListener="#{departmentController.create}"
value="#{bundle.Save}"
update=":DepartmentListForm:results,
:growl,
display,
:DepartmentListForm:messages" />
<p:spacer width="10"/>
<p:commandButton value="#{bundle.Cancel}"
process=":DepartmentListForm"
action="#{departmentController.cancel}"
onclick="DepartmentCreateDialog.hide()"
ajax="false"
update=":DepartmentListForm:results"
immediate="true" />
</div>
</h:panelGroup>
</h:form>
</p:dialog>
I need create a list of Phones in na and submit before.
In my firt try the object came empty and the list shows a list of null objets
<h:panelGrid id="gridPhone" columns="5">
<h:outputText value="Numero:" />
<h:inputText value="#{profileMB.phone.number}" size="10"/>
<h:outputText value="Tipo" />
<p:selectOneMenu id="selPhoneType" value="#{profileMB.phone.type}" >
<f:selectItems var="phoneType" value="#{profileMB.listPhoneTypes}" itemLabel="#{phoneType.description}" itemValue="#{phoneType}" />
</p:selectOneMenu>
<p:commandButton action="#{profileMB.addPhoneOnList()}" immediate="true" value="adicionar" update=":messageGrowl listPhones"/>
<f:facet name="footer">
<h:panelGroup style="display:block; text-align:center;width: 300px;">
<p:selectOneListbox id="listPhones" >
<f:selectItems var="phones" value="#{profileMB.phones}" itemLabel="#{phones.number}" />
</p:selectOneListbox>
</h:panelGroup>
</f:facet>
<p:ajaxStatus style="display:block;margin-bottom:2em;height:24px;">
<f:facet name="default">
<h:outputText value="" />
</f:facet>
<f:facet name="start">
<p:graphicImage name="/images/spiffygif_30x30.gif" />
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</h:panelGrid>
in my second try the object was filled but the Litt does update
<h:panelGrid id="gridPhone" columns="5">
<h:outputText value="Numero:" />
<h:inputText value="#{profileMB.phone.number}" size="10"/>
<h:outputText value="Tipo" />
<p:selectOneMenu id="selPhoneType" value="#{profileMB.phone.type}" >
<f:selectItems var="phoneType" value="#{profileMB.listPhoneTypes}" itemLabel="#{phoneType.description}" itemValue="#{phoneType}" />
</p:selectOneMenu>
<p:commandButton action="#{profileMB.addPhoneOnList()}" partialSubmit="true" process="gridPhone, listPhones" value="adicionar" update=":messageGrowl"/>
<f:facet name="footer">
<h:panelGroup style="display:block; text-align:center;width: 300px;">
<p:selectOneListbox id="listPhones" >
<f:selectItems var="phones" value="#{profileMB.phones}" itemLabel="#{phones.number}" />
</p:selectOneListbox>
</h:panelGroup>
</f:facet>
<p:ajaxStatus style="display:block;margin-bottom:2em;height:24px;">
<f:facet name="default">
<h:outputText value="" />
</f:facet>
<f:facet name="start">
<p:graphicImage name="/images/spiffygif_30x30.gif" />
</f:facet>
<f:facet name="complete">
<h:outputText value="" />
</f:facet>
</p:ajaxStatus>
</h:panelGrid>
I have try sereval forms but dont work
:(
I have an issue with primefaces datagrid.I am trying to update the dialog box with the selected values on click of p:commandLink.
The Dialog doesnt display any values initially but it gets updated with the previously selected values when i refresh the page and click on commandLink.
I am using primefaces-2.2.1 on JBoss 4.3.0.Any help would be appreciated.
<p:column>
<p:panel header="#{loc.loc_details}" style="text-align:center">
<h:panelGrid columns="1" style="width:100%">
<p:graphicImage value="/user/xyz/resources/images/#{loc.loc_details}.jpg"/>
<h:outputText value="#{loc.locality}" />
<h:outputText value="#{loc.city}" />
<h:outputText value="#{loc.state}" />
<p:commandLink update="locDetail,locDetailGrid" oncomplete="locDialog.show()" title="View Detail" border="0" >
<p:graphicImage value="/user/xyz/resources/images/imagesCA6ETPOM.jpg" />
<f:setPropertyActionListener value="#{loc}"
target="#{tutorialsBean.selectedLocality}" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:column>
<p:dialog header="Loc Detail" widgetVar="locDialog" modal="true">
<p:outputPanel id="locDetail" style="text-align:center;" layout="block">
<h:panelGrid id="locDetailGrid" columns="2" cellpadding="5">
<h:outputLabel for="loc_details" value="Locality Details :" />
<h:outputText id="loc_details" value="#{tutorialsBean.selectedLocality.loc_details}" />
<h:outputLabel for="city" value="City: " />
<h:outputText id="city" value="#{tutorialsBean.selectedLocality.city}" />
<h:outputLabel for="state" value="State: " />
<h:outputText id="state" value="#{tutorialsBean.selectedLocality.state}" />
<h:outputText styleClass="text_normal" value="First Name" />
<p:inputText id="fnameText" value="#{tutorialsBean.firstName}" />
<h:outputText styleClass="text_normal" value="Last Name" />
<p:inputText id="lnameText" value="#{tutorialsBean.lastName}" />
<h:outputText styleClass="text_normal" value="Email" />
<p:inputText id="emailText" value="#{tutorialsBean.email}" />
<p:commandButton id="searchButton"
value="Submit" action="#{tutorialsBean.submitValues}"
styleClass="button" />
</h:panelGrid>
</p:outputPanel>
in you commandLink add the update and process attributes in your dialog to refresh the information.
like this:
Put the ID in dialog:
<p:dialog header="Loc Detail" id="locDialog" widgetVar="locDialog" modal="true">
Put the Update to dialog:
<p:commandLink update="locDetail,locDetailGrid" oncomplete="locDialog.show()" title="View Detail" border="0" update="locDialog" process="#this" ajax="true" partialSubmit="true" >
<p:graphicImage value="/user/xyz/resources/images/imagesCA6ETPOM.jpg" />
<f:setPropertyActionListener value="#{loc}" target="#{tutorialsBean.selectedLocality}" />
</p:commandLink>