如何从jQuery触发JSF渲染 [英] How to trigger JSF render from jQuery
本文介绍了如何从jQuery触发JSF渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在jQuery中触发jsf <f:ajax render>
?
Is it possible to trigger jsf <f:ajax render>
inside an jQuery?
例如这样的东西:
/* if component Y changes
trigger render event on component Y */
$("#source_compoment").bind("change", function(e) {
$("#target_component").trigger("render");
});
或者换句话说,jQuery中是否有"f:ajax渲染"的等效项?
Or with other words is there an equivalent for "f:ajax render" within jQuery?
推荐答案
是的,创建一个隐藏按钮
Yes , make a hidden button
<h:commandButton id="myHiddenButtonID" value="RenderSomething" style="display:none">
<f:ajax render="target_component"></f:ajax>
</h:commandButton>
然后从js单击它
$("#myHiddenButtonID").click();
在您的特定情况下,它将如下所示:
in your specific case it will look like this:
$("#source_compoment").bind("change", function(e) {
$("#myHiddenButtonID").click();
});
b.t.w没有等同于jQuery中的"f:ajax渲染"",您只需使用jquery单击一个隐藏的JSF按钮即可.
b.t.w there is no "equivalent for "f:ajax render" within jQuery" you simple use jquery to click a hidden JSF button.
修改
如果与第三方JSF库的使用相关,则可以使用
In case a third party JSF Library usage is relevant you can use the
Primefaces RemoteCommand-(使用更新属性)
或
Richfaces/a4j:jsFunction-(使用reRender属性)
这篇关于如何从jQuery触发JSF渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文