I have a list (p:dataTable
) of elements. If I select an element, a detail of it is shown on a p:dialog
. The detail presents another list, of another kind of elements. If I select an element from that list, another p:dialog
opens with its details.
Now, I can edit those details and update the entry, but the update
parameter is not working. The list is not re-rendered. I have to close the dialog and open it again.
I also have to use a weird onkeyup
to update EVERY textarea with the class newEventCommentClass
. Otherwise #{event.comment}
gets filled with an empty string instead of the p:inputTextarea
value.
I've tried all kinds of combinations:
update="@all"
closes all dialogs.- Combinations such as
update="@form"
,update="@form:issueEvents"
update="@this :issueDetail"
,update="@this @(.issueEventsClass)"
andupdate="@this :issueEvents"
do nothing.
When I open the inner dialog directly instead of from another dialog I don't have any problems to re-render the list using the update=":elementId"
method.
How can I make it work too when the detail dialog opens from the parent detail dialog of another list?
This is the "outer" dialog code I am using:
<p:dialog
closeOnEscape="true"
widgetVar="commissionDetail"
id="commissionDetail"
modal="true"
width="60%"
>
<ui:include src="/views/widgets/commission_detail_edit.xhtml" />
</p:dialog>
And this the "inner" dialog code (note I have to use appendTo="@(body)"
, otherwise it opens inside the modal lock set by the parent dialog):
<p:dialog
closeOnEscape="true"
widgetVar="issueDetail"
id="issueDetail"
modal="true"
appendTo="@(body)"
>
<p:ajax event="close" update=":manageCommissionSession:commissionSessionIssues" />
<ui:include src="/views/widgets/issue_detail_edit.xhtml" />
</p:dialog>
This is the "outer" dialog content, commission_detail_edit.xhtml
:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<h:form id="manageCommissionSession" prependId="false">
<p:dataTable
id="commissionSessionIssues"
value="#{myCommissionsController.selectedCommissionSession.issues}"
var="tissue"
selection="#{issue}"
selectionMode="single"
rowKey="#{tissue.idIssue}"
>
<p:ajax event="rowSelect" listener="#{myIssuesController.onSelectOneRow}" update=":issueDetail" oncomplete="PF('issueDetail').show();"/>
<p:column headerText="#{i18n['issue.title']}">
<h:outputText value="#{tissue.title}" />
</p:column>
<p:column headerText="#{i18n['issue.description']}">
<h:outputText value="#{tissue.description}" />
</p:column>
</p:dataTable>
</h:form>
<p:dialog
// ... (the dialog code shown above)
</p:dialog>
</ui:composition>
This is the "inner" dialog content, issue_detail_edit.xhtml
:
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
>
<h:form id="manageIssue" styleClass="manageIssueClass" prependId="false">
<p:commandButton
id="saveNewEventButton"
value="#{i18n.saveEvent}"
action="#{newIssueController.addIssueEvent}"
process="@this @(.newEventCommentClass)"
update="@this @(.issueEventsClass)"
/>
<br />
<p:inputTextarea
id="newEventComment"
styleClass="newEventCommentClass"
value="#{event.comment}"
onkeyup="$('.newEventCommentClass').val($(this).val())"
/>
<p:dataTable
id="issueEvents"
styleClass="issueEventsClass"
value="#{myIssuesController.selectedIssue.events}"
var="tevent"
>
<p:column headerText="#{i18n['date']}">
<h:outputText value="#{tevent.eventDate}" />
</p:column>
<p:column headerText="#{i18n['comment']}">
<h:outputText value="#{tevent.comment}" />
</p:column>
</p:dataTable>
</h:form>
</ui:composition>