问题描述
我现在在tabView中使用confirmDialog有问题。
这是我的confirmDialog
I now have problem with using confirmDialog inside tabView.Here is my confirmDialog
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
<h:form>
<p:commandButton value="Yes" type="button"
styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button"
styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</h:form>
</p:confirmDialog>
在第一个tabView中,我有一个确认按钮
In the 1st tabView, I have a button with confirmation
<p:commandButton value="Import" icon="ui-icon-arrowrefresh-1-w"
update=":form:growl">
<p:confirm header="Confirmation" message="Are you sure?" />
</p:commandButton>
在第二个tabView中,我正好是那个按钮。
In the 2nd tabView, I have exactly that button.
现在我的问题是:在第一个选项卡中,我的confirmDialog具有我想要的全文:标题和消息,但是在第二个选项卡中,标题和消息都变为null。只有按钮yes和no确认对话框仍然工作。我不知道发生了什么,请帮助我,如何确认对话框在所有tabView中显示全部内容
And now my problem is: In the 1st tab, my confirmDialog have full text as I want: header and message, however in the 2nd tab, the header and message all become "null". Only button yes and no of confirmDialog still work. I don't know what is happening, please help me, how to make confirmDialog display full content in all tabView
推荐答案
为我工作好见下面的例子
It seems to work ok for me. See example below
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>JSF User Dialog</title>
</h:head>
<h:body>
<h3>This is a JSF view.</h3>
<h:form id="form">
<p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
<h:form>
<p:commandButton value="Yes" type="button"
styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
<p:commandButton value="No" type="button"
styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</h:form>
</p:confirmDialog>
<p:tabView id="tabView">
<p:tab id="tab1" title="Tab one ">
<p:commandButton value="Import" icon="ui-icon-arrowrefresh-1-w"
update=":form">
<p:confirm header="Confirmation" message="Are you sure?" />
</p:commandButton>
</p:tab>
<p:tab id="tab2" title="Tab two">
<p:commandButton value="Import" icon="ui-icon-arrowrefresh-1-w"
update=":form">
<p:confirm header="Confirmation" message="Are you sure?" />
</p:commandButton>
</p:tab>
</p:tabView>
</h:form>
</h:body>
</html>
输出:
如果您发布完整的xhtml代码,我们可以看到什么可能是那里的问题。
It would be good if you post your full xhtml code so we can see what could be the problem there.
这篇关于表示p:confirmDialog内部的tabView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!