Primefaces confirmDialog doesn't show up after one call - jsf-2

I have a problem with PrimeFaces <p:confirmDialog>, when I click on the <p:commandLink> that must show up the dialog and choose 'No', everything is fine. But when I click on yes,everything works just the first time.
When the process is over and I click again on any <p:commandLink>, the dialog doesn't show up unless I refresh the whole page.I had try everything but I cannot figure out what can be the problem.
<h:form>
<p:dataTable border="0" rules="all" value="#{userBean.users}" var="user" autoUpdate="true" styleClass="table table-hover" paginator="true" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="6,10,15" >
<p:column>
<f:facet name="header">
<h:outputText value="Login" />
</f:facet>
<h:outputText value="#{user.login}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="" />
</f:facet>
<p:commandLink class="badge bg-red marge-left" onclick='PF("cdu#{user.id}").show()' title="Supprimer un utilisateur"><span class="fa fa-trash-o"/></p:commandLink>
<p:confirmDialog ajax="true" message="Voulez vous vraiment supprimer l'utilisateur '#{user.login}'" closable="true" header="Confirmation" severity="alert" widgetVar="cdu#{user.id}" >
<p:commandButton value="oui" actionListener="#{userBean.deleteUser}" update="#form" onclick='PF("cdu#{user.id}").hide()' styleClass="btn btn-primary"/>
<p:commandButton value="non" onclick='PF("cdu#{user.id}").hide()' type="button" styleClass="btn btn-danger" />
</p:confirmDialog>
</p:column>
</p:dataTable>
</h:form>

I had finally resolved my problem. I changed the <p:confirmDialog> by a global one and it works.
<h:form>
<p:dataTable border="0" rules="all" value="#{userBean.users}" var="user" autoUpdate="true" styleClass="table table-hover">
<p:column>
<f:facet name="header">
<h:outputText value="Login" />
</f:facet>
<h:outputText value="#{user.login}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Nom" />
</f:facet>
<h:outputText value="#{user.firstName} #{user.lastName}" />
</p:column>
<p:column style="width:200px;">
<f:facet name="header">
<h:outputText value="Email" />
</f:facet>
<h:outputText value="#{user.email}" />
</p:column>
<p:column >
<f:facet name="header">
<h:outputText value="" />
</f:facet>
<p:commandLink class="badge bg-blue marge-left" action="#{userBean.getUserRowToEdit}" title="Editer un utilisateur" ><span class="fa fa-edit"/></p:commandLink>
<p:commandLink class="glyphicon glyphicon-trash icon-trash" actionListener="#{userBean.deleteUser}" title="Supprimer un utilisateur" update="#form">
<p:confirm header="Confirmation" message="Voulez-vous vraiment supprimer l'utilisateur?" icon="ui-icon-alert"/>
</p:commandLink>
</p:column>
</p:dataTable>
<p:confirmDialog global="true">
<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>
</h:form>

I tried your code and repaired it a little. Hope it will work for you too.
-I removed ajax="true"
-usersBean.deleteUser function need to know which user to so -> deleteusersBean.deleteUser(user)
Under is my code that i use to test your case. A few things are changed due to existing beans i have. This code is tested on latest primefaces(5.2).
my xhtml file:
<p:column>
<f:facet name="header">
<h:outputText value="" />
</f:facet>
<p:commandLink class="badge bg-red marge-left" value="delete" onclick='PF("cdu#{user.userId}").show()' title="Supprimer un utilisateur"><span class="fa fa-trash-o"/></p:commandLink>
<p:confirmDialog message="Voulez vous vraiment supprimer l'utilisateur '#{user.name}'" closable="true" header="Confirmation" severity="alert" widgetVar="cdu#{user.userId}" >
<p:commandButton value="oui" actionListener="#{loginBean.deleteUser(user)}" update="#form" onclick='PF("cdu#{user.userId}").hide()' styleClass="btn btn-primary"/>
<p:commandButton value="non" onclick='PF("cdu#{user.userId}").hide()' type="button" styleClass="btn btn-danger" />
</p:confirmDialog>
</p:column>
</p:dataTable>
</h:form>
my loginBean:
public class LoginBean implements Serializable {
private static final long serialVersionUID = 6188046073588310656L;
private List<User> users= new ArrayList<User>();
public LoginBean() {
}
public List<User> getUsers() {
if(users.size()==0){
for (int i= 0; i<3; i++){
User u = new User();
u.setUserId(i);
u.setName("noob"+i);
users.add(u);
}
}
return users;
}
public void deleteUser(User user){
users.remove(user);
}
}

Related

After Filtering Primefaces Datatable not show The Filtered Row Details in a dialog box

I use jsf 2.2 and Primefaces 4.0 in my project. but I faced a problem . After Filter Primefaces Datatable. I want to show the filtered Row ditails in a dialog but after filter, Row ditails not show dialog box . Even Until Reload the page don't show Row Details in the dialog box . My Jsf Code Is ..........
<h:form id="Form_showRequest" style="font-size: 10pt;">
<input type="text" id="search" placeholder="Search now..."></input>
<p:growl id="MSG_grl" autoUpdate="false" showDetail="true"/>
<p:dataTable id="TBL_data" var="List_request" value="#{allRequestBean.requestDetailsList}" scrollable="true" widgetVar="reTab"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
scrollHeight=" 460" style="font-size: 10pt; font-family: serif;margin-bottom:0;">
<p:column headerText="Mobile No" style="width: 80px;" filterBy="#{List_request.mobileNumber}" >
#{List_request.mobileNumber}
</p:column>
<p:column headerText="User Name" style="width: 80px;">
#{List_request.userName}
</p:column>
<p:column headerText="Amount" style="width: 50px;">
#{List_request.rechargeAmount}
</p:column>
<p:column headerText="Cost" style="width: 50px;">
#{List_request.costAmount}
</p:column>
<p:column headerText="Service" style="width: 100px;">
#{List_request.serviceName}
</p:column>
<p:column headerText="Bank " style="width: 50px;">
#{List_request.bankName}
</p:column>
<p:column headerText="Bank Tran Id" style="width: 100px;">
#{List_request.bankTrankId}
</p:column>
<p:column headerText="Date Time" style="width: 150px;" >
#{List_request.rechargeDate}
</p:column>
<p:column headerText="Conformation Id" style="width: 100px;">
#{List_request.conformationId}
</p:column>
<p:column headerText="Status" style="width: 80px;">
<h:outputText value="#{List_request.rechargeStatusName}"/>
</p:column>
<p:column id="op" headerText="Option" style="width: 100px">
<p:commandButton id="but" value="Action" action="#{actionBean.allReRowDetails()}"
update=":Form_showRequest:PNL_action" style=" font-size: 10px" onclick="PF('widget_action').show();"
ajax="true" disabled="#{List_request.rechargeStatusId eq 4 or List_request.rechargeStatusId eq 5}">
<f:setPropertyActionListener value="#{List_request}" target="#{actionBean.allRequestBeanValue}"/>
</p:commandButton>
<p:commandLink id="requestDetails" value="Details" action="#{allRequestDetailsBean.rowDetails()}"
update=":Form_showRequest:PNL_request" oncomplete="PF('widget_request').show();" ajax="true" >
<f:setPropertyActionListener value="#{List_request}" target="#{allRequestDetailsBean.allRequestBeanValue}" />
</p:commandLink>
</p:column>
</p:dataTable>
<p:dialog id="Dialog_acton" header="Action" widgetVar="widget_action" modal="true">
<h:panelGrid id="PNL_action" style="margin-bottom:10px; width: 300px;" cellpadding="10">
<p:selectOneRadio id="action" columns="1" value="#{actionBean.actionType}">
<f:selectItem itemLabel="Resend" itemValue="1" />
<f:selectItem itemLabel="Complete" itemValue="4" />
<f:selectItem itemLabel="Cancel" itemValue="5" />
</p:selectOneRadio><br/>
<p:outputLabel value="Reason" style="width:20px; "/>
<p:inputTextarea value="#{actionBean.confirmId}" style="width: 250px" />
</h:panelGrid>
<p:commandButton value="Ok" action="#{actionBean.action()}" update="Form_showRequest:TBL_data,MSG_grl"
oncomplete="widget_action.hide()" style="width: 200px; margin-left: 50px;"/>
</p:dialog>
<p:dialog id="Dialog_request" header="Request Details Information" widgetVar="widget_request" showEffect="clip" hideEffect="fold" resizable="false" >
<p:panelGrid id="PNL_request" columns="2" style="width: 450px" >
<p:outputLabel value="Recharge Id :"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeId}"/>
<p:outputLabel value="User Name:"/>
<p:outputLabel value=" #{allRequestDetailsBean.userName}"/>
<p:outputLabel value="Mobile Number :"/>
<p:outputLabel value=" #{allRequestDetailsBean.mobileNumber}"/>
<p:outputLabel value="Recharge Amount:"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeAmount}"/>
<p:outputLabel value="Cost :"/>
<p:outputLabel value=" #{allRequestDetailsBean.costAmount}"/>
<p:outputLabel value="Number Type:"/>
<p:outputLabel value=" #{allRequestDetailsBean.numberType}"/>
<p:outputLabel value="Operator :"/>
<p:outputLabel value=" #{allRequestDetailsBean.operatorName}"/>
<p:outputLabel value="Service :"/>
<p:outputLabel value=" #{allRequestDetailsBean.serviceName}"/>
<p:outputLabel value="Bank Nmae:"/>
<p:outputLabel value=" #{allRequestDetailsBean.bankName}"/>
<p:outputLabel value="Bank Transaction Id:"/>
<p:outputLabel value=" #{allRequestDetailsBean.bankTrankId}"/>
<p:outputLabel value="Ip Address:"/>
<p:outputLabel value=" #{allRequestDetailsBean.ipAddress}"/>
<p:outputLabel value="Time:"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeDate}"/>
<p:outputLabel value="Invoice No:"/>
<p:outputLabel value=" #{allRequestDetailsBean.invoiceNo}"/>
<p:outputLabel value="Conformation Id:"/>
<p:outputLabel value=" #{allRequestDetailsBean.conformationId}"/>
<p:outputLabel value="Status:"/>
<p:outputLabel value=" #{allRequestDetailsBean.rechargeStatusName}"/>
</p:panelGrid>
</p:dialog>
</h:form>
I Solved it by this code write in p:dataTable tag ....
filteredValue="#{allRequestDetailsBean.filteredRequest}"
and also create a list in allRequestDetailsBean
private List<AllRequestBean> filteredRequest;

Primefaces Datagrid is working but popup is empty

Why my popup is empty . image is coming but data is not coming ..
<p:dataGrid var="publicationVar" value="#{adminhome.lazyModel}"
columns="5" id="imageGridId" lazy="true" rows="15" paginator="true"
style="float: left;" binding="#{adminhome.dataGrid}"
emptyMessage="Records non trovati!"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="5,10,15" paginatorPosition="bottom"
rendered="#{adminhome.renderImages}">
<p:column id="colGridId">
<p:panel style="width: 50%;" id="panlId">
<h:panelGrid id="panGridId">
<p:commandLink oncomplete="dlg2.show()" update=":form:tesss"
process="#this" id="comLinkId">
<p:graphicImage id="grapImgId"
value="#{publicationVar.imageTmbPath}" width="140" height="160"
style="margin-right: -12px" alt="#{publicationVar.ISSNcode}"
title="#{publicationVar.editore}, #{publicationVar.title}, € #{publicationVar.priceStr}" />
<f:setPropertyActionListener value="#{publicationVar}"
target="#{adminhome.selectedPubblicazioni}" id="setPropId" />
</p:commandLink>
</h:panelGrid>
</p:panel>
</p:column>
</p:dataGrid>
Here is the dialog box . I can see blank dialog .But it was working before the lazy concept is introduced .
<p:dialog id="modalDialog" widgetVar="dlg2" modal="true" height="100%" dynamic="true">
<p:outputPanel id="tesss">
<p:panelGrid>
<p:row>
<p:column rowspan="13" >
<div style="width:100%;height:100%">
<h:commandLink action="popup.xhtml" target="_blank" >
<p:graphicImage style="margin-left:5px" value="#{adminhome.selectedPubblicazioni.imagePath}" height="500" width="375" />
</h:commandLink>
</div>
</p:column>
</p:row>
<p:row> <p:column> <h:outputText value="Data " style="float: left;margin-left: 30px;color:red;font-size: 18px;font-weight: bold"/> </p:column> <p:column> <h:outputText value="#{adminhome.selectedPubblicazioni.sample}" style="float: left;"/> </p:column> </p:row>
<p:row> <p:column> <h:outputText value="Name " style="float: left;margin-left: 30px;color:red;font-size: 18px;font-weight: bold"/> </p:column> <p:column> <h:outputText value="#{adminhome.selectedPubblicazioni.ename}" style="float: left;"/> </p:column> </p:row>
<p:row> <p:column> <h:outputText value="Code " style="float: left;margin-left: 30px;color:red;font-size: 18px;font-weight: bold"/> </p:column> <p:column><h:outputText value="#{adminhome.selectedPubblicazioni.code}" style="float: left;"/> </p:column> </p:row>
<p:row> <p:column> <h:outputText value="Sample " style="float: left;margin-left: 30px;color:red;font-size: 18px;font-weight: bold"/> </p:column> <p:column> <h:outputText value="#{adminhome.selectedPubblicazioni.sample}" style="float: left;"/> </p:column> </p:row>
</p:panelGrid>

Backing bean method is getting null from inputs

This project is made with Primefaces 3.5, JSF 2.0, Oracle database.
The view:
<h:form id="schedule" class="schedule">
// more JSF and forms and dialogs
<p:dialog widgetVar="patientDialog" dynamic="true" header="Find Patient" showEffect="clip" hideEffect="explode" modal="true" >
<h:form id="frmPatient">
<h:panelGrid id="findPatient" columns="1">
<h:panelGrid id="findPatientParameters" columns="2">
<h:outputLabel value="Firstname: " />
<p:inputText id="name" label="name" size="15" value="#{waitinglistBean.name}" />
<h:outputLabel value="Patient Code: " />
<p:inputText id="pcode" label="pcode" size="15" value="#{waitinglistBean.pcode}" />
<br />
<p:commandButton value="Search" process="name" actionListener="#{waitinglistBean.patients}" update="patients"/>
</h:panelGrid>
<h:panelGrid id="findPatientDetails" columns="1">
<p:dataTable id="patients" var="patient" resizableColumns="true" scrollable="true" scrollWidth="1250"
scrollHeight="150" value="#{waitinglistBean.patients}"
rowKey="#{patient.PCode}" selection="#{waitinglistBean.selectedPatient}"
selectionMode="single" >
<f:facet name="header">
Click "Select" button after selecting a row to select patient.
</f:facet>
<p:column width="150" headerText="Code">
#{patient.PCode}
</p:column>
<p:column width="150" headerText="Family Name">
#{patient.PLname}
</p:column>
<p:column width="150" headerText="First Name">
#{patient.PFname}
</p:column>
<p:column headerText="Sex" >
#{patient.PSex}
</p:column>
<p:column headerText="Birthdate">
#{patient.PBorn}
</p:column>
<p:column headerText="Street">
#{patient.PStreet}
</p:column>
<f:facet name="footer">
<p:commandButton id="viewButton" value="Select" icon="ui-icon-search"
oncomplete="patientDialog.hide()"
update=":frmDialogs:frmWaiting:tabView:patientDetails"
process="patients"/>
</f:facet>
</p:dataTable>
</h:panelGrid>
</h:panelGrid>
</h:form>
</p:dialog>
<p:dialog widgetVar="patientDialog" dynamic="true" header="Find Patient" showEffect="clip" hideEffect="explode" modal="true" >
<h:form id="frmPatient">
<h:panelGrid id="findPatient" columns="1">
<h:panelGrid id="findPatientParameters" columns="2">
<h:outputLabel value="Firstname: " />
<p:inputText id="name" label="name" size="15" value="#{waitinglistBean.name}" />
<h:outputLabel value="Patient Code: " />
<p:inputText id="pcode" label="pcode" size="15" value="#{waitinglistBean.pcode}" />
<br />
<p:commandButton value="Search" process="name" actionListener="#{waitinglistBean.patients}" update="patients"/>
</h:panelGrid>
<h:panelGrid id="findPatientDetails" columns="1">
<p:dataTable id="patients" var="patient" resizableColumns="true" scrollable="true" scrollWidth="1250"
scrollHeight="150" value="#{waitinglistBean.patients}"
rowKey="#{patient.PCode}" selection="#{waitinglistBean.selectedPatient}"
selectionMode="single" >
<f:facet name="header">
Click "Select" button after selecting a row to select patient.
</f:facet>
<p:column width="150" headerText="Code">
#{patient.PCode}
</p:column>
<p:column width="150" headerText="Family Name">
#{patient.PLname}
</p:column>
<p:column width="150" headerText="First Name">
#{patient.PFname}
</p:column>
<p:column headerText="Sex" >
#{patient.PSex}
</p:column>
<p:column headerText="Birthdate">
#{patient.PBorn}
</p:column>
<p:column headerText="Street">
#{patient.PStreet}
</p:column>
<f:facet name="footer">
<p:commandButton id="viewButton" value="Select" icon="ui-icon-search"
oncomplete="patientDialog.hide()"
update=":frmDialogs:frmWaiting:tabView:patientDetails"
process="patients"/>
</f:facet>
</p:dataTable>
</h:panelGrid>
</h:panelGrid>
</h:form>
</p:dialog>
// more JSF and dialogshizzle
</h:form>
The backing bean:
#ManagedBean(name="waitinglistBean")
#ViewScoped
public class WaitinglistBean implements Serializable
{
private Patients patient;
private OrWaitinglist orWaitinglist;
private List<Patients> patients = new ArrayList<Patients>();
private String name;
private Integer pcode;
public WaitinglistBean() {
}
public void setSelectedPatient(Patients patient) {
this.patient = patient;
}
public Patients getSelectedPatient() {
return patient;
}
public OrWaitinglist getOrWaitinglist() {
return orWaitinglist;
}
public void setOrWaitinglist(OrWaitinglist orWaitinglist) {
this.orWaitinglist = orWaitinglist;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPcode() {
return pcode;
}
public void setPcode(Integer pcode) {
this.pcode = pcode;
}
public List<Patients> getPatients() {
PatientsDao patientsDao = new PatientsDaoImpl();
patients = patientsDao.getSearchPatient(name, pcode);
System.out.println(name + " " + pcode);
return patients;
}
public void createOrWaitinglist()
{
orWaitinglist.setPatients(patient);
}
So first a user enter a string: "Firstname" and an Integer: "Patient Code".
When he hits the "Search" button it fires the actionListener="#{patientBean.patients}
inside that commandbutton. The method needs 2 parameter, name and pcode which have their own setters/getters.
When I look in console it shows me the printout of these 2 parameters, and they are twice "null", so that means the parameters from the JSF pages were not passed to the backing bean, although the value of the inputText has been set to the backingbean set method: value="#{patientBean.name}"
My question now is why do I get these null-values. I've read several posts which use these setters, but still I get null-values.
after edit i still have the same problem;
for send value of input component in h:panelgrid to the backingbean use somthing like this:
<p:commandButton value="Search" process="#(frmPatient:findPatientParameters :input)"
actionListener="#{patientBean.patients}" update="patients"/>

Primefaces poll not updating panel

I can't figure out why my primefaces poll will not update any components.
<p:poll widgetVar="poll"
interval="#{messageBean.refreshInterval}"
listener="#{messageBean.refreshLiveData}"
update=":transactionLogForm:tabViewMain:liveViewPanel"/>
The refreshLiveData method gets called successfully but it refuses to update the outputText component (or any component for that matter).
<p:tab id="liveViewTab" title="Live View">
<h:panelGrid id="liveViewPanel" columns="6" cellpadding="5">
<h:outputText value="Live View Enabled: " />
<p:selectBooleanCheckbox value="#{messageBean.liveViewActive}">
</p:selectBooleanCheckbox>
<h:outputText value="Interval: " />
<p:spinner id="interval" value="#{transactionLogBean.refreshInterval}" />
<h:outputText value="Last Update:" />
<h:outputText id="lastUpdated" value="#{transactionLogBean.lastUpdated}" />
</h:panelGrid>
</p:tab>
Here is the full code from within the body tags:
<p:layout id="mainLayout" fullPage="true" style="height:100%" >
<h:form id="transactionLogForm">
<p:poll widgetVar="poll"
interval="#{messageBean.refreshInterval}"
listener="#{messageBean.refreshLiveData}"
update=":transactionLogForm:tabViewGrids:messageTable :transactionLogForm:tabViewGrids:timestatTable :transactionLogForm:tabViewMain:liveViewPanel"/>
<p:layoutUnit id="topHeader" position="north" size="178" >
<ui:include src="inc_menu.xhtml" />
</p:layoutUnit>
<p:layoutUnit id="center" position="center" >
<div>
<p style="font-size: 20px; font-weight: bold; padding: 0px 0px 0px 10px">Transaction Logs</p>
</div>
<p:tabView id="tabViewMain" orientation="top">
<p:tab title="Reference No">
<h:panelGrid columns="2" cellpadding="5">
<p:inputTextarea id="referenceNo" rows="1" cols="100" value="#{transactionBean.referenceNo}" style="width:300px"/>
<p:commandButton id="refreshBtnMain0" value="Search" action="#{transactionBean.searchTranLogDetails(true)}"
update=":transactionLogForm:transactionSearchTable" ajax="true"
oncomplete="txnDialog.show()"
style="vertical-align: baseline"/>
</h:panelGrid>
</p:tab>
<p:tab title="Log Id">
<h:panelGrid columns="2" cellpadding="5">
<p:inputText id="logID" value="#{transactionLogBean.logID}" style="width:300px"/>
<p:commandButton id="refreshBtnMain1" value="Refresh" action="#{transactionLogBean.refreshData}" update=":transactionLogForm:tabViewGrids:messageTable :transactionLogForm:tabViewGrids:timestatTable" ajax="true" />
</h:panelGrid>
</p:tab>
<p:tab title="Date Range">
<h:panelGrid columns="5" cellpadding="5">
<h:outputText value="Start Date:" />
<p:calendar id="StartDate" pattern="dd/MM/yyyy HH:mm:ss" navigator="true" value="#{transactionLogBean.startDate}" />
<h:outputText value="End Date:" />
<p:calendar id="EndDate" pattern="dd/MM/yyyy HH:mm:ss" navigator="true" value="#{transactionLogBean.endDate}" />
<p:commandButton id="refreshBtnMain2" value="Refresh" action="#{transactionLogBean.refreshData}" update=":transactionLogForm:tabViewGrids:messageTable :transactionLogForm:tabViewGrids:timestatTable" ajax="true" />
</h:panelGrid>
</p:tab>
<p:tab id="liveViewTab" title="Live View">
<h:panelGrid id="liveViewPanel" columns="6" cellpadding="5">
<h:outputText value="Live View Enabled: " />
<p:selectBooleanCheckbox value="#{messageBean.liveViewActive}">
</p:selectBooleanCheckbox>
<h:outputText value="Interval: " />
<p:spinner id="interval" value="#{transactionLogBean.refreshInterval}" />
<h:outputText value="Last Update:" />
<h:outputText id="lastUpdated" value="#{transactionLogBean.lastUpdated}" />
</h:panelGrid>
</p:tab>
</p:tabView>
<p:tabView id="tabViewGrids">
<p:tab title="Message Logs">
<ui:include src="inc_messagelogs.xhtml" />
</p:tab>
<p:tab title="Timestat Logs">
<ui:include src="inc_timestatlogs.xhtml" />
</p:tab>
</p:tabView>
<p:dialog header="Log Message" widgetVar="logDialog" id="logDlg" showEffect="fade">
<h:outputText id="msg" value="#{transactionLogBean.selectedLogMessage}"/>
</p:dialog>
<p:dialog header="Transaction Search Results" widgetVar="txnDialog" resizable="false" id="tranDlg"
showEffect="fade" modal="false" position="center">
<p:dataTable id="transactionSearchTable" value="#{transactionBean.tranlogList}"
var="t" widgetVar="tranSearchTable" rowKey="#{t.transactionId}"
selectionMode="single" selection="#{transactionBean.selectedTranlog}"
paginator="true" rows="10" style="font-size:14px"
rowStyleClass="#{t.rowColour}">
<p:ajax event="rowSelect" update=":transactionLogForm:tabViewGrids:messageTable :transactionLogForm:tabViewGrids:timestatTable"
listener="#{transactionLogBean.refreshData(transactionBean.selectedTranlog.logId)}"
oncomplete="txnDialog.hide()" global="false"/>
<p:column style="text-align: left">
<f:facet name="header">
Tran Id
</f:facet>
#{t.transactionId}
</p:column>
<p:column style="text-align: left" sortBy="#{t.dateCreated}">
<f:facet name="header">
Date/Time
</f:facet>
#{t.dateCreated}
</p:column>
<p:column style="text-align: left" sortBy="#{t.transactionType}">
<f:facet name="header">
Tran Type
</f:facet>
#{t.transactionType}
</p:column>
<p:column style="text-align: left">
<f:facet name="header">
Amount
</f:facet>
#{t.amount}
</p:column>
<p:column style="text-align: left">
<f:facet name="header">
Result
</f:facet>
#{t.externalMessageCode}
</p:column>
</p:dataTable>
</p:dialog>
</p:layoutUnit>
</h:form>
</p:layout>
I'm not getting any errors reported, so all the references must be ok - please help!!!
I'm using JSF 2.0, Primefaces 3.4.RC1
Extract from generated html:
<div id="transactionLogForm:tabViewMain:liveViewTab" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-helper-hidden" role="tabpanel" aria-hidden="true"><table id="transactionLogForm:tabViewMain:liveViewPanel" cellpadding="5">
<tbody>
<tr>
<td>Live View Enabled: </td>
<td><div id="transactionLogForm:tabViewMain:j_idt27" class="ui-chkbox ui-widget"><div class="ui-helper-hidden-accessible"><input id="transactionLogForm:tabViewMain:j_idt27_input" name="transactionLogForm:tabViewMain:j_idt27_input" type="checkbox" /></div><div class="ui-chkbox-box ui-widget ui-corner-all ui-state-default"><span class="ui-chkbox-icon"></span></div></div><script id="transactionLogForm:tabViewMain:j_idt27_s" type="text/javascript">PrimeFaces.cw('SelectBooleanCheckbox','widget_transactionLogForm_tabViewMain_j_idt27',{id:'transactionLogForm:tabViewMain:j_idt27'});</script></td>
<td>Interval: </td>
<td><span id="transactionLogForm:tabViewMain:interval" class="ui-spinner ui-widget ui-corner-all"><input id="transactionLogForm:tabViewMain:interval_input" name="transactionLogForm:tabViewMain:interval_input" type="text" class="ui-spinner-input ui-inputfield ui-state-default ui-corner-all" autocomplete="off" value="10" /><a class="ui-spinner-button ui-spinner-up ui-corner-tr ui-button ui-widget ui-state-default ui-button-text-only"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-n"></span></span></a><a class="ui-spinner-button ui-spinner-down ui-corner-br ui-button ui-widget ui-state-default ui-button-text-only"><span class="ui-button-text"><span class="ui-icon ui-icon-triangle-1-s"></span></span></a></span><script id="transactionLogForm:tabViewMain:interval_s" type="text/javascript">$(function(){PrimeFaces.cw('Spinner','widget_transactionLogForm_tabViewMain_interval',{id:'transactionLogForm:tabViewMain:interval',step:1.0});});</script></td>
<td>Last Update:</td>
<td><span id="transactionLogForm:tabViewMain:lastUpdated"></span></td>
</tr>
</tbody>
</table>
</div>
Problem solved - it was a backing bean issue after all and had nothing to do with the poll itself which was working fine.

Dropdown's valueChangeListener not working with primefaces datatable

I have datatable and a dropdown within a xhtml. If I am deleting p:datatable code within this page then I am able to call the valueChangeListener of dropdown , but if p:datatable is present in xhtml, then I am not able to call it.
Xhtml code is
<ui:define name="content">
<f:view>
<h:form id="accountSummaryForm" prependId="false">
<h:selectBooleanCheckbox id="checkbox" value="true" />
<h:outputLabel value="Show certificates preview on sumit"></h:outputLabel>
<h:outputLabel value="Show certificates preview on sumit"></h:outputLabel>
<h:outputText align="left"
value="Value is #{reqSummaryHandler.certNumber}" />
<p:dataTable id="reqActList" paginatorAlwaysVisible="true"
var="reqInfo" value="#{reqSummaryHandler.certActListModel}"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
paginator="true" rows="#{label.accountList_defaultNumberOfRows}"
selectionMode="single"
rowsPerPageTemplate="#{label.accountList_numberOfRows}" width="60%">
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="#{label.certNumber}" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.certNumber}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Version" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.certVersionNbrString}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Insured" />
</f:facet>
<ui:repeat value="#{reqInfo.clientList}" var="insuredInfo">
<h:outputText align="left"
value="#{insuredInfo.generalPartyInfo.nameInfo.commName.commercialName}" />
</ui:repeat>
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Certificate Holder" />
</f:facet>
<ui:repeat value="#{reqInfo.certificateHolderInfoList}"
var="certHoldInfo">
<h:outputText align="left"
value="#{certHoldInfo.additionalInterest.generalPartyInfo.nameInfo.commName.commercialName}" />
</ui:repeat>
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Activity Performed" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.effectiveTypeCd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Certificate Status" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.statusCd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Third Party" />
</f:facet>
<h:outputText align="left"
value="#{reqInfo.certWordingEndorsementInd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Manual Form" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.manualEntryInd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Manual Addendum" />
</f:facet>
<h:outputText align="left" value="#{reqInfo.mnlAddendumInd}" />
</p:column>
<p:column style="text-align:center;" filterBy="" sortBy=""
width="5%">
<f:facet name="header">
<h:outputLabel value="Path" />
</f:facet>
<p:cellEditor>
<f:facet name="output">
<h:outputText align="left" value="#{reqInfo.routePathCd}"
readonly="true" />
</f:facet>
<f:facet name="input">
<h:selectOneMenu value="#{reqInfo.routePathCd}">
<f:selectItem itemLabel="Issue Distribute" itemValue="A" />
<f:selectItem itemLabel="Send to Underwriter" itemValue="B" />
<f:selectItem itemLabel="Issue Do Not Distribute"
itemValue="C" />
</h:selectOneMenu>
</f:facet>
</p:cellEditor>
<p:rowEditor rendered="#{reqInfo.statusCd eq 'A'}" />
</p:column>
<p:column style="text-align:center;white-space: normal;nowrap">
<f:facet name="header">
<h:outputLabel value="Action" />
</f:facet>
<ui:repeat value="#{reqInfo.availableFunctions.functionNameArray}"
var="linkInfo">
<p:commandLink id="View" value="#{linkInfo}" ajax="false" />
<br />
</ui:repeat>
</p:column>
</p:dataTable>
<p:spacer width="50" height="0"></p:spacer>
<p:spacer width="50" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<p:spacer width="3" height="0"></p:spacer>
<h:outputLabel value="Assign Path" style="font-weight:bold" />
<p:spacer width="5" height="10" />
<h:selectOneMenu id="dropdown2"
valueChangeListener="#{reqSummaryHandler.DoPathProcessing1}"
value="#{reqSummaryHandler.certNumber}" onchange="submit();">
<f:selectItem itemLabel="Issue Distribute" itemValue="A" />
<f:selectItem itemLabel="Send to Underwriter" itemValue="B" />
<f:selectItem itemLabel="Issue Do Not Distribute" itemValue="C" />
</h:selectOneMenu>
</h:form>
</f:view>
</ui:define>
And listener code is
public void DoPathProcessing1(ValueChangeEvent event) {
String newValue = (String) event.getNewValue();
System.out.println("Path"
+ certActListModel.getRowData().getRoutePathCd());
certActListModel.getRowData().setRoutePathCd(newValue);
System.out.println("value is " + newValue);
}
Any idea why it is not working?
I am using jsf-api-2.0.3 and primefaces-2.2.1
You are using both the value and the valueChangeListener attributes of the drop down component. Why would you do this?
Just having value="#{reqSummaryHandler.certNumber} will call setCertNumber(String certNumber) in your managed bean. Why not just put this code into the setter method?

Resources