I'm having an issue with global confirmDialog. When I load a page confirmDialog opens up and does the deed, however when I want to use it a second time on the page, dialog opens, however yes/no buttons don't work anymore. If I refresh the page (hit F5 in the browser), it works again once, and then not anymore until a page refresh. I tried different combinations none worked. Any ideas what could be wrong?
There is a form and datatable in it, in the header there is delete button, it has confirm dialog. ConfirmDialog buttons themselves are defined in the same form after the datatable.
Edit1: Sorry, it doesn't work at all. It must have something to do with form+table+update cascade. I'm totally annoyed now. Find below the source pls if you wanna help.
Regards,
Ozgur
Code: Select all
<h:form>
<p:dataTable id="firmsTable" var="firm" value="#{companyView.firmsDM}" lazy="true" paginator="true" rows="10" paginatorPosition="bottom"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {CurrentPageReport} {RowsPerPageDropdown}" selectionMode="single"
selection="#{companyView.selectedFirm}" rowKey="#{firm}" draggableColumns="true" style="white-space: nowrap; margin-bottom: 20px; vertical-align: top;"
rowsPerPageTemplate="10,50,100" sortMode="multiple">
<f:facet name="header">
<table>
<tr>
<td style="border-style: none">#{msg['titles.firms']}</td>
<td style="border-style: none; width: 120px">
<table>
<tr>
<td style="border-style: none">
<p:commandButton icon="ui-icon-add" actionListener="#{firmDialog.insert()}"
update="@([id$=firmDialogId])" oncomplete="PF('firmDialog').show()" />
</td>
<td style="border-style: none">
<p:commandButton icon="ui-icon-pencil" actionListener="#{firmDialog.edit(companyView.selectedFirm)}"
update="@([id$=firmDialogId])" oncomplete="PF('firmDialog').show()" disabled="#{companyView.selectedFirm eq null}" />
</td>
<td style="border-style: none">
<p:commandButton icon="ui-icon-trash" actionListener="#{companyView.deleteFirm}" disabled="#{companyView.selectedFirm eq null}"
update="@([id$=firmsTable]),@([id$=subFirmsTable])">
<p:confirm header="Confirmation" message="Are you sure?" icon="ui-icon-alert" />
</p:commandButton>
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade" width="300">
<p:commandButton value="#{msg['words.yes']}" type="button" styleClass="ui-confirmdialog-yes GreenButton" icon="ui-icon-check" />
<p:commandButton value="#{msg['words.no']}" type="button" styleClass="ui-confirmdialog-no RedButton" icon="ui-icon-close" />
</p:confirmDialog>
</td>
</tr>
</table>
</td>
</tr>
</table>
</f:facet>
<p:ajax event="rowSelect" update="@([id$=subFirmsTable]),@(button)" />
<p:ajax event="rowUnselect" />
<p:column sortBy="#{firm.firmID.name}" filterBy="#{firm.firmID.name}" filterMatchMode="startsWith" headerText="#{msg['fields.code']}">
<h:outputText value="#{firm.firmID.name}" />
</p:column>
<p:column sortBy="#{firm.description}" filterBy="#{firm.description}" filterMatchMode="startsWith" headerText="#{msg['fields.desc']}">
<h:outputText value="#{firm.description}" />
</p:column>
</p:dataTable>