Ajax是否“更新"了?确定后,“渲染"是假的吗? [英] Is Ajax "update" ok after "render" was false?

查看:91
本文介绍了Ajax是否“更新"了?确定后,“渲染"是假的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于先前将render选项设置为false,我是否可以向尚未渲染的JSF组件发送Ajax更新"命令:

Can I send Ajax "update" commands to JSF components that have not been rendered due to render option previously set to false:

render="#{BackingBean.doRender}"

在发送更新"之前,将

doRender设置为true.

doRender is set to true just before "update" has been sent.

这是正确的方法吗?

我正在使用PrimeFaces,即使同时将doRender设置为true,也无法显示update后的一个组件.

I am using PrimeFaces and one component does not show after update even doRender is set to true in the meantime.

推荐答案

ajax更新由JavaScript与JSF生成的HTML DOM树一起工作(正如Web浏览器已检索到的一样).如果未呈现JSF组件,则它根本不会出现在HTML DOM树中,因此JavaScript找不到任何要更新的内容.

The ajax update works by JavaScript with the JSF-generated HTML DOM tree (as the webbrowser has retrieved). If a JSF component is not rendered, then it does not appear in the HTML DOM tree at all and hence JavaScript can't find anything to update.

您需要更新一个父组件,该组件始终显示. .

You need to update a parent component instead, which is always rendered.

例如

<h:panelGroup id="foo">
    <h:someComponent rendered="#{bean.rendered}" />
</h:panelGroup>

使用

<p:commandButton ... update="foo" />

这篇关于Ajax是否“更新"了?确定后,“渲染"是假的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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