Hello,
I have changed the sample code of xhtml a bit, moved the confirmation dialog inside the the roleTableForm, it still doesn't refresh the roleTable, please refer to below:
Code: Select all
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:form id="roleTableForm">
<p:outputPanel id="roleTablePanel">
<p:dataTable id="roleTable" value="#{roleController.roles}" var="_role"
paginatorTemplate="{RowsPerPageDropDown} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport}" rows="8"
emptyMessage="No Records to Display"
>
<p:column sortBy="#{_role.roleId}" filterBy="#{_role.roleId}">
<f:facet name="header">
<h:outputText value="Role ID" />
</f:facet>
<h:outputText value="#{_role.roleId}" />
</p:column>
<p:column sortBy="#{_role.roleName}" filterBy="#{_role.roleName}">
<f:facet name="header">
<h:outputText value="Role Name" />
</f:facet>
<h:outputText value="#{_role.roleName}" />
</p:column>
<p:column style="width:32px">
<p:menuButton value="Actions">
<p:menuitem value="Delete" update="confirmTxtId"
oncomplete="confirmDelete.show()"
icon="ui-icon ui-icon-arrowrefresh-1-w">
<f:setPropertyActionListener value="#{_role}" target="#{roleController.selectedRole}"/>
</p:menuitem>
</p:menuButton>
</p:column>
<f:facet name="footer">
In total there are #{roleController.count} roles.
<p:commandButton value="Refresh" actionListener="#{roleController.refreshTable}" update="roleTableForm:roleTable" />
</f:facet>
</p:dataTable>
<p:confirmDialog message="" showEffect="fade" hideEffect="fade" header="Confirmation dialog" severity="alert" widgetVar="confirmDelete">
<f:facet name="message">
<h:outputText id="confirmTxtId" value="Delete Role [ ID: #{roleController.selectedRole.roleId}, Role name: #{roleController.selectedRole.roleName} ]?" escape="false"/>
</f:facet>
<p:commandButton value="Yes Sure" update="roleTableForm:roleTable" oncomplete="confirmDelete.hide()" actionListener="#{roleController.deleteRole}" />
<p:commandButton value="Not Yet" onclick="confirmDelete.hide()" type="button" />
</p:confirmDialog>
</p:outputPanel>
</h:form>
</html>
and when I followed the user guide as shown in page 55 to refresh confirmTxtId, that also dosn't work. roleId and roleName are empty.
Have I done anything wrong?
Thanks
Sam