如何在jsf中解决周围的命名容器? [英] How to address the surrounding naming container in jsf?

查看:62
本文介绍了如何在jsf中解决周围的命名容器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带<p:dataTable>的jsf 2.0页面,并且在此表内有一个<p:commandButton>,应使用ajax请求从该表中删除一个项目.删除本身可以正常工作,但我不知道如何为渲染update识别周围的<p:dataTable>.

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>

我已经尝试过update="dataTable",但是mojarra找不到它 (由于其他原因,它不起作用)

I already tryed update="dataTable" but mojarra did not find it ( it did not worked for an other reason)

所以我的问题是如何解决周围的命名容器,而无需使用以根UIComponent开头的绝对路径(因为那样的话,我需要命名很多命名容器.)

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

推荐答案

假定表单中的所有内容都具有prependId="false"作为属性,则dataTable的update属性值应该起作用.

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

子组件的PrimeFaces更新属性可识别父dataTable组件的ID.此外,您还可以在PrimeFaces更新中使用@parent值来重新呈现子元素的直接父容器.

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.

这篇关于如何在jsf中解决周围的命名容器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆