How to address the surrounding naming container in jsf?

限于喜欢 提交于 2020-01-04 05:08:27

问题


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.)


回答1:


Assuming that you have everything within a form that has prependId="false" as an attribute, then the update attribute value of dataTable should work.

The PrimeFaces update attribute of child components recognizes the id of a parent dataTable component. Furthermore you can also use the @parent value within PrimeFaces update to re render a child elements immediate parent container.



来源:https://stackoverflow.com/questions/12088654/how-to-address-the-surrounding-naming-container-in-jsf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!