When I have one button that use .show() on a confirmDialog all is fine.
When I dynamically add more buttons that use same dialog and click either it shows multiple popups and one big popup with many confirm buttons:
What ca be causing that. I have tried both 2.2.RC2 and SNAPSHOT.
reference to p:confirmDialog from many buttons
This is the code that generates the screenshot from previous post:
A commandlink (inside an ui:repeat)
ConfirmDialog (outside the ui:repeat):
Once the the list behind ui:repeat is expanded dynamically with another ajax request. - clicking delete will show many and faulty confirmdialogs.
A commandlink (inside an ui:repeat)
Code: Select all
<p:commandLink id="accountDeleteButton"
value="[Delete]"
onclick="accountDeleteConfirmation.show()"
update="accountDeleteConfirmationDialog" style="text-decoration: none; float:left; padding-top: 5px; ">
<f:setPropertyActionListener value="#{account}" target="#{configurationController.currentObjectForDelete}" />
</p:commandLink>
Code: Select all
<p:confirmDialog id="accountDeleteConfirmationDialog" appendToBody="true"
message="Are you sure you want to delete the account?"
header="Please confirm" severity="alert"
widgetVar="accountDeleteConfirmation">
<p:commandLink value="[Yes]" update="top,center"
oncomplete="accountDeleteConfirmation.hide()"
actionListener="#{configurationController.deleteAccount}"/>
<p:commandLink value="[No]"
onclick="accountDeleteConfirmation.hide()" />
</p:confirmDialog>
I think the problem is not the ui:repeat, but the fact that you are trying to update (re-render) the confirm dialog using AJAX:
I had a similar problem a few weeks ago and I was told that updating a confirm dialog is not supported. Your dialog seems to be static, so I guess you could just remove that update tag... otherwise, if you for example want to customize the message before showing the dialog, put the message into a f:facet with the name "message", and only update that facet instead of the entire dialog.
(For normal dialogs, updating the entire dialog seems to work fine though... I only encountered these issues with the ConfirmDialog so far...)
Code: Select all
update="accountDeleteConfirmationDialog"
(For normal dialogs, updating the entire dialog seems to work fine though... I only encountered these issues with the ConfirmDialog so far...)
Hi all,
I had a similar issue when I try to update an element using the <p:commandLink> within ui:repeat tag (also using AJAX).
Since form prependId attribute is set to true by default, when you post the form, javax.faces.partial.rendered property should include the
prepended id in front of the updated element's id. (Which is not the case). Solution is setting the prependId to false. Then you can update the elements
using commandLink and Ajax.
Here my test case, (it does not work if prependId is set to true)
I hope this helps ...
Emre
I had a similar issue when I try to update an element using the <p:commandLink> within ui:repeat tag (also using AJAX).
Since form prependId attribute is set to true by default, when you post the form, javax.faces.partial.rendered property should include the
prepended id in front of the updated element's id. (Which is not the case). Solution is setting the prependId to false. Then you can update the elements
using commandLink and Ajax.
Here my test case, (it does not work if prependId is set to true)
Code: Select all
<h:form prependId="false" id="form">
<p:panel id="panel" header="Panel">
<h:outputText id="output" value="#{loginBean.userName}"/>
</p:panel>
<p:panel header="User Names">
<h:panelGrid columns="1">
<ui:repeat value="#{loginBean.names}" var="name">
<p:commandLink ajax="true" update="output">
<f:setPropertyActionListener value="#{name}" target="#{loginBean.userName}"/>
<h:outputText value="#{name}"/><br/>
</p:commandLink>
</ui:repeat>
</h:panelGrid>
</p:panel>
</h:form>
Emre
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
I think you can now update a dialog itself with ajax, we have beaten that limitation with 2.2.
confirmDialog doesn't have it now, you can create a feature request. Same solution shall apply.
confirmDialog doesn't have it now, you can create a feature request. Same solution shall apply.
Hi Cagatay,
In my case I was trying to update content of the dialog using the command links created in ui:repeat tags. I have primefaces-2.2.RC2. (I tried to upgrade to v.2.2 but then started getting some "Unexpected error restoring state for component with id j_idt3. Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0." error. Then reverted to v.2.2 RC2)
The dialog to be updated:
The command links updating the dialog:
Without setting prependId to false, it does not update dialog. When I checked the post parameters, I see it is passing javax.faces.partial.render=editDialog (I think the form id should be prepended to this id)
I am wondering whether this issue has been beaten with 2.2? Do you think this is a feature or a bug?
Regards
Emre
In my case I was trying to update content of the dialog using the command links created in ui:repeat tags. I have primefaces-2.2.RC2. (I tried to upgrade to v.2.2 but then started getting some "Unexpected error restoring state for component with id j_idt3. Cause: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0." error. Then reverted to v.2.2 RC2)
The dialog to be updated:
Code: Select all
<p:dialog id="editDialog" closable="true" widgetVar="dialog">
<ui:insert name="lineEdit">
<ui:include src="/components/#{bean.editedLine}.xhtml"/>
</ui:insert>
</p:dialog>
Code: Select all
<p:panel header="Composition">
<h:panelGrid columns="1" bgcolor="yellow">
<ui:repeat value="#{bean.lines}" var="line">
<p:commandLink ajax="true" update="editDialog" oncomplete="dialog.show()">
<f:setPropertyActionListener value="#{line}" target="#{bean.editedLine}"/>
<h:outputText value="#{line}"/><br/>
</p:commandLink>
</ui:repeat>
</h:panelGrid>
</p:panel>
I am wondering whether this issue has been beaten with 2.2? Do you think this is a feature or a bug?
Regards
Emre
-
- Information
-
Who is online
Users browsing this forum: No registered users and 7 guests