本文介绍了如何通过RequestContext更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用RequestContext.update()更新表以下代码正在运行(jsf):
I am trying to update a table by using RequestContext.update()The following code is working (jsf):
<h:panelGrid columns="2" style="width: 100%" columnClasses="treeColumn,tableColumn">
<h:panelGroup id="treePanel">
<p:tree id="tree"
value="#{bean.root}"
var="node"
dynamic="true"
cache="true"
animate="true"
selectionMode="single"
selection="#{bean.selectedNode}"
rendered="#{bean.renderTree}">
<p:ajax event="select" listener="#{bean.onNodeSelect}" update=":mainForm:treePanel,:mainForm:tablePanel"/>
<p:ajax event="collapse" listener="#{bean.onNodeCollapse}"/>
<p:treeNode expandedIcon="ui-icon-folder-open"
collapsedIcon="ui-icon-folder-collapsed">
<h:outputText value="#{node.name}" styleClass="tableTreeText"/>
</p:treeNode>
<p:treeNode expandedIcon="ui-icon-folder-open"
collapsedIcon="ui-icon-folder-collapsed">
<h:outputText value="#{node.name}" styleClass="tableTreeText"/>
</p:treeNode>
</p:tree>
</h:panelGroup>
<h:panelGroup id="tablePanel" styleClass="acqPanelTable">
<p:dataTable id="acqDataTable"
widgetVar="acqTablehdsWidget"
var="acq"
value="#{bean.list}"
rendered="#{bean.renderTable}"
filteredValue="#{bean.filteredList}"
paginator="true"
paginatorPosition="bottom"
.....
....
...
..
.
但不通过服务器端:
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.update(":mainForm:tablePanel");
renderTable = true;
我不知道有什么不同?
感谢您的帮助,
谢谢
推荐答案
删除前导冒号.
requestContext.update("mainForm:tablePanel");
始终相对于UIViewRoot
进行解析.仅当您当前坐在视图的UINamingContainer
组件中时,前导冒号才有效.
It's always resolved relative to UIViewRoot
. The leading colon is only valid when you're currently sitting in an UINamingContainer
component in the view.
这篇关于如何通过RequestContext更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!