I have a jsf 2.0 page with a <p:dataTable> and inside this table a <p:commandButton> that should delete an item from this table with an ajax request. The deleting itself works fine, but I do not know how to identify the surrounding <p:dataTable> for the render update.
<lots of naming containers>
...
<p:dataTable id="dataTable" var="userItem" ... />
<p:column>
<p:commandButton
action="#{userController.doDelete(userItem.id)}"
value="delete"
update="?????"/> <!-- How to address the dateTable? -->
</p:column>
</p:dataTable>
<.lots of naming containers>
I already tryed update="dataTable" but mojarra did not find it
(Edit: it did not worked for an other reason)
So my question is how to address the surrounding naming container, WITHOUT using a absolute path that starts at root UIComponent (because then I would need to name a lot of naming containers.)
Assuming that you have everything within a form that has
prependId="false"as an attribute, then the update attribute value ofdataTableshould work.The PrimeFaces update attribute of child components recognizes the id of a parent dataTable component. Furthermore you can also use the
@parentvalue within PrimeFaces update to re render a child elements immediate parent container.