JSF-Javascript调用Primefaces组件
JSF Javascript calls Primefaces componants
hi我想从java脚本函数定期调用backbean我想刷新页面的一个面板,而不是整个页面这是我用脚本写的
$('#submitbutton').click();
<h:commandButton id="submitbutton" immediate="true" value="" styleClass="ui-day" style="border:0;display : none;"
action="#{liveGraphBean.plotInterval1('daily')}" >
而不是刷新,我只想刷新页面的面板
<p:panel id="dailyGraphPanel">
<div id="chartdiv" style="width: 100%; height: 400px;"></div>
</p:panel>
那么我该怎么做呢感谢
您可以使用Primeface Poll标签
http://www.primefaces.org/showcase/ui/ajax/poll.xhtml
http://www.primefaces.org/showcase/ui/ajax/remoteCommand.xhtml
<h:commandButton id="submitbutton" immediate="true" value="Submit" styleClass="ui-day" style="border:0;display : none;" action="#{liveGraphBean.plotInterval1('daily')}">
<f:ajax render="dailyGraphPanel" execute="@this"/>
</h:commandButton>
或
<p:commandButton id="submitbutton" immediate="true" value="Submit" styleClass="ui-day" style="border:0;display : none;" action="#{liveGraphBean.plotInterval1('daily')}" update="dailyGraphPanel" process="@this" />
<h:panelGroup id="dailyGraphPanel">
<div id="chartdiv" style="width: 100%; height: 400px;"></div>
</h:panelGroup>
我还建议您使用http://www.primefaces.org/showcase/ui/ajax/poll.xhtml
IMHO,将您的图表组件#chartdiv刷新与面板刷新分组会更简单、更干净。
然而,一个快速的解决方案,只需很少的修改,也许可以满足你没有解释的限制,你可以从切换
<h:commandButton id="submitbutton" immediate="true" value="" styleClass="ui-day" style="border:0;display : none;" action="#{liveGraphBean.plotInterval1('daily')}" >
至
<p:commandButton id="submitbutton" immediate="true" value="" styleClass="ui-day" style="border:0;display : none;" action="#{liveGraphBean.plotInterval1('daily')}" update="dailyGraphPanel">
根据p:commandButton和p:panel的相对位置,pour可能需要调整要更新的组件的路径,或者只需要使用一个方便的素数函数,p:component
<p:commandButton id="submitbutton" immediate="true" value="" styleClass="ui-day" style="border:0;display : none;" action="#{liveGraphBean.plotInterval1('daily')}" update="#{p:component}">
我在h:commandButton文档中看不到更新属性http://docs.oracle.com/javaee/6/javaserverfaces/2.0/docs/pdldocs/facelets/但你会在p:commandButton中找到它http://www.primefaces.org/docs/vdl/3.5/primefaces-p/commandButton.html
您应该阅读PrimeFaces文档中的"部分渲染"部分,以获得有关其工作原理的更详细解释(PrimeFace优秀用户指南第498页第4.1节http://www.primefaces.org/docs/guide/primefaces_user_guide_5_0.pdf)。
- React重新渲染但未显示正确的组件
- 不能从angular2中的子组件指定父组件中的数组
- 在jQuery就绪函数上未完成Primefaces布局组件
- 在页面出口的PrimeFaces中检测客户端对UI组件的更改
- 在 jsf/primefaces 组件中评估 javascript 结果
- 如何在基于 widgetVaR 的 Primefaces 组件中找到和/或覆盖 JavaScript
- 如何更新p的标签:在primefaces中ajax调用后,在不关闭组件的情况下选择CheckboxMenu
- 在PrimeFaces中的某些组件更新时自动调用javascript
- 素Html文件中的Primefaces组件使用
- 从JavaScript调用托管bean方法,最终填充Primefaces对话框组件
- 如何从JavaScript刷新PrimeFaces编辑器组件
- JSF-Javascript调用Primefaces组件
- Primefaces防止其他组件渲染
- 如何在标签中连接Primefaces UI和JavaScript组件
- 如何在不使用的情况下重写primefaces组件内联样式!在css中很重要
- PrimeFaces p:blockUI动态地阻塞某个组件(在JSF EL条件下)
- fitBounds在PrimeFaces gmap组件中
- PrimeFaces如何取消filterBy组件上的事件侦听器
- 用javascript中的函数更新Primefaces组件值
- IE8中不同Primefaces组件的JavaScript错误