Prime Faces命令链接ajax无法正常工作 [英] prime faces command link ajax not working
问题描述
我正在尝试将Ajax与命令链接一起使用以更新对话框.表单没有任何ID,我也无法运行此页面,它说未找到对话框"/不存在
I am trying to use Ajax with a command link to update a dialog. Te form doesn't have any id, I am not able to run this page also, it says component with "dialog" not found/doesn't exist
<h:form>
<p:tabView id="tabView">
<p:tab id="tab1" title="Tab 1">
<h:panelGrid columns="1" cellpadding="10">
<h:dataTable value="#{testBean.dataList}" var="data">
<h:column>
<h:outputText value="#{data}" />
</h:column>
<h:column>
<p:commandLink action="#{testBean.loadCommentHistory(data)}"
update="dialog" oncomplete="dlg.show()">
<h:graphicImage url="resources/theme1/images/comments.gif"
styleClass="basicImageStyle" />
</p:commandLink>
</h:column>
</h:dataTable>
<p:dialog id="dialog" header="Dynamic Dialog" widgetVar="dlg">
<h:outputText value="#{testBean.commentHistory}" />
</p:dialog>
</h:panelGrid>
</p:tab>
</p:tabView>
</h:form>
推荐答案
p:dataTable
本身是一个容器. p:commandLink
在 p:dataTable
中搜索ID为"dialog"的元素.
The p:dataTable
itself is a container. The p:commandLink
is searching within the p:dataTable
for an element with an id "dialog".
解决方案:在表单中添加一个id,并将对话框称为:formid:dialog".
Solution: add an id to the form and refer to the dialog as ":formid:dialog".
p:tabView
或 p:tab
也是一个容器,因此请在浏览器中检查对话框的ID并使用该对话框.;-)应该注意避免将id用作 jdt_id4
.
The p:tabView
or the p:tab
is also a container so check the id of the dialog in your browser and use that one. ;-) It should be noted to avoid id's as jdt_id4
.
这篇关于Prime Faces命令链接ajax无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!