First of all, this will indeed never work with a <h:commandLink>
, simply because it doesn't support the update
attribute at all. Perhaps you actually meant to use <p:commandLink>
?
Once you've fixed the <h:commandLink>
being a <p:commandLink>
, then head to this answer: How to find out client ID of component for ajax update/render? Cannot find component with expression "foo" referenced from "bar" to learn how to reference components in JSF ajax.
After having read that answer, you should have found out that the datatable is in this particular code snippet identified by :formId:tableId
. So, all with all, the following should do:
<p:commandLink value="remove" update=":formId:tableId" />
Note that there's until with PrimeFaces 3.3 a bug in ajax-updating of the <p:dataTable>
in certain complex UI compositions. This is fixed in PrimeFaces 3.4. If you encounter exactly this problem and can't upgrade to PrimeFaces 3.4, then you'd need to wrap the table in some <h:panelGroup id="tablePanelId">
and then use update=":formId:tablePanelId"
instead.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…