I need your help in refreshing the values in the datatable
component after clicking on the commandButton
in the dialog. The jsf code is:
<h:form id="Requests">
<h:panelGroup id="table">
<p:fieldset id="Pendings">
<p:dataTable id="PendingRequests">
</p:dataTable>
<p:dialog header="cert1">
<p:commandButton value="Print" id="Print" actionListener="#{msd.updatePrint}" />
</p:dialog>
</p:fieldset>
</h:panelGroup>
</h:form>
The Print commandButton will fire a SQL UPDATE statement that will increment the count of the printing status in the database by 1. So if the value of the Printing Status column in the dataTable
= 1, then this will increment by 1 and total will 2. Now, I want the dataTable
in the parent page to pick up the change and to show that the Printing Status = 2.
I tried to add the below lines in the updatePrint()
method but the increment is not shown in the dataTable:
public void updatePrint() {
//SQL UPDATE STATEMENT
RequestContext context = RequestContext.getCurrentInstance();
context.update(":Requests:Pendings:PendingRequests");
}
I tried also to use ajax but I wasn't success :
<p:dialog header="cert1">
<p:ajax event="close" update=":Requests:Pendings:PendingRequests" />
</p:dialog>