当以preFIX格式ID与结肠癌 [英] When to prefix form id with colon

查看:168
本文介绍了当以preFIX格式ID与结肠癌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两种形式两个DataTable,备考 formg 的。在每个窗体有一个号码:dataTable中 groupsa groupsg 的。在每个数据表中有显示图像( H:graphicImage的)的自定义列名为蚕豆 favg 的。

I have two datatables in two forms, forma and formg. Inside each form there is a p:dataTable, groupsa and groupsg. In each datatable there is a custom column that displays an image(h:graphicImage) called fava and favg.

当图像被点击,从另一数据表中的图像将被更新。

When the image is clicked, the images from the other datatable will be updated.

<p:ajax event="click" listener="#{agent.toogleFavorite}"
update="fava, :formg:groupsg:favg" />

没有冒号我得到一个异常:

Without the colon I get an exception:

javax.faces.FacesException: Cannot find component with identifier "forma:agentsa:fava" referenced from "groupsg:0:favg".

之间是什么formg的区别:和favg:groupsg formg:groupsg:favg

What is the difference between formg:groupsg:favg and :formg:groupsg:favg?

我使用JSF2.0和PrimeFaces 3.4。

I am using JSF2.0 and PrimeFaces 3.4.

推荐答案

preFIX将使它成为绝对的客户端ID,因此它会被搜索相关对 UIViewRoot ,而不是最近的父到 NamingContainer 。您应当(必须)使用它的时候要引用一个组件,它是不一样的最接近的父元素内 NamingContainer 。该&LT; H:形式GT; &LT; H:dataTable的&GT; (和&LT;号码:dataTable的&GT; )的 NamingContainer 组件

The : prefix will make it an absolute client ID and thus it will be searched relative to the UIViewRoot instead of the closest parent NamingContainer. You should (must) use it when you want to refer a component which is not inside the same closest parent NamingContainer. The <h:form> and <h:dataTable> (and <p:dataTable>) are NamingContainer components.

另请参见<一个href="http://stackoverflow.com/questions/8634156/how-to-reference-components-in-jsf-ajax-cannot-find-component-with-identifier/8644762#8644762">How引用组件的JSF AJAX?无法找到标识符QUOT组成部分;富&QUOT;鉴于进行了详细的解释。

See also How to reference components in JSF ajax? Cannot find component with identifier "foo" in view for a detailed explaination.

这篇关于当以preFIX格式ID与结肠癌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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