Monday, December 9, 2019

update tag behavior for components nested in Primefaces dataTable

I discovered the hard way that update="someComponentId" does not work for a commandLink nested inside a datatable. After some searching I found that you must use the syntax 'update=":formId:componentId" to make the update work. E.g., the example below works, but if I change the commandLink update to update="#{viewName}MembersPanel", an error results:

                <p:dataTable id="#{viewName}MemberDataTable"
                             var="member"
                             value="#{wizardController.members}"
                             emptyMessage="No members added.">

                    <p:column headerText="Cable name">
                        <h:outputText value="#{member.name}" />
                    </p:column>

                    <p:column headerText="Action">
                        <p:commandLink  id="#{viewName}RemoveCommandLink"
                                        value="Remove"
                                        action="#{wizardController.removeMember(member)}"
                                        onstart="PF('loadingDialog').show()"
                                        oncomplete="PF('loadingDialog').hide();update#{rootViewId}WizardButtons();"
                                        update="@form:#{viewName}MembersPanel"
                                        process="@form:#{viewName}MembersPanel">
                        </p:commandLink>
                    </p:column>

                </p:dataTable>

No comments: