I have p:dataTable
and display p:dialog
when datatable row is clicked twice using <p:ajax event="rowDblselect" immediate="true" process="@this" oncomplete="PF('tgelPrintForm').show();" update=":form:modalDialog" />
. In the dialog I have a buttion that chages state one of the selected datatable rows cell. Problem is that I don't know how to update that cell with the new value. I think I need some primefaces configuration and primefaces will update that automatically but since I am very new to JSF and Primefaces it is problem for me to solve that issue. This is my code below.
datatable:
<p:dataTable styleClass="myDataGrid" id="tbl2" var="domesticTransactions" value="#{domesticTransferGridManagedBean.domesticTransactions}"
paginator="true" rows="15" rowKey="#{domesticTransactions.id}" scrollable="true" scrollHeight="280"
paginatorPosition="bottom"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
selection="#{domesticTransferGridManagedBean.selectedDomesticTransfer}" selectionMode="single">
<p:ajax event="rowDblselect" immediate="true" process="@this" oncomplete="PF('tgelPrintForm').show();" update=":form:modalDialog" />
dialog:
<p:dialog dynamic="true" id="modalDialog" appendToBody="@{body}" widgetVar="tgelPrintForm"
modal="true" height="400" width="750px" resizable="false" closeOnEscape="true"> <c:choose>
<c:when test="#{domesticTransferGridManagedBean.selectedDomesticTransfer.status eq 'WAITING_FOR_FIRST_SIGNER_SIGN'}">
<p:commandButton actionListener="#{domesticTransferGridManagedBean.addFirstSignerSignToDomesticTransaction}"
id="domesticTransferFirstSignerSign"
value="#{msg['label.FirstSignerSignature']}"
styleClass="myButton"
process="@this"
update="status"
oncomplete="PF('tgelPrintForm').hide()">
</p:commandButton>
managed bean method:
private DomesticTransfer selectedDomesticTransfer;
public void addFirstSignerSignToDomesticTransaction() {
try {
long domesticTransferId = selectedDomesticTransfer.getId();
assert domesticTransferId > 0;
selectedDomesticTransfer = domesticTransferService.addFirstSignToDomesticTransfer(domesticTransferId);
} catch(Exception e) {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO, e.getMessage(), null));
}
}