tli*_*ind 5 ajax jsf repeat jsf-2
我的页面由几个区域组成,这些区域是通过迭代使用的项目列表创建的<ui:repeat>.想象一下这个简化的例子:
<h:form id="form">
<ui:repeat id="repeatContainer" var="item" value="#{testBean.items}" varStatus="status">
<h:outputText value="#{item.title}: "/>
<!-- I want to re-render only a single one of these fields -->
<h:outputText id="valueContainer" value="#{item.value}"/><br/>
</ui:repeat>
</h:form>
Run Code Online (Sandbox Code Playgroud)
现在,我想使用AJAX(例如,索引为1的元素)重新渲染(仅)此列表valueContainer中的特定元素.我已经尝试过所有这些组合而没有任何运气:
<!-- Works, but renders all items: -->
<f:ajax render=":form"/>
<!-- This is what I actually want to achieve (does not work, comp. not found): -->
<f:ajax render=":form:repeatContainer:1:valueContainer"/>
<!-- Does not work (component not found): -->
<f:ajax render=":form:repeatContainer"/>
<!-- Does not work (component not found): -->
<f:ajax render=":form:repeatContainer:1"/>
<!-- Does not work (component not found): -->
<f:ajax render=":form:1"/>
<!-- Does not work (component not found): -->
<f:ajax render=":form:1:valueContainer"/>
<!-- Does not work (no error message, but does nothing): -->
<f:ajax render=":form:repeatContainer:valueContainer"/>
Run Code Online (Sandbox Code Playgroud)
我的要求包括:
@all/ @form)对我来说是无用的,因为这样会让我对使用JSF/AJAX的原因产生疑问......<p:dataGrid>单元格来实现相同的功能(即仅更新特定单元格的特定子组件),但我认为这会减少到同样的问题.我想我必须有一个简单的解决方案,我目前正在俯瞰?!
这似乎是由 Mojarra 2.0.2 中的两个单独的错误引起的。以下线程讨论了一个相关问题: 如何在数据表中引用数据表父级?
就我而言,我使用的是 PrimeFaces<p:dataGrid>而不是<h:dataTable>,但它似乎遇到了相同的症状。参考文献只是失败了。UIComponent#findComponent()我认为这与JSF 实现中的错误或底层方法有关。
看来目前这个问题没有解决方案...除了等待 JSF 实现得到修复...如果其他人有进一步的建议,请随时添加。
| 归档时间: |
|
| 查看次数: |
5407 次 |
| 最近记录: |