Primefaces对话框隐藏方法打破了我的CSS

时间:2014-08-12 10:18:06

标签: jsf jsf-2 primefaces

我试图让用户接受从数据表中选择的出价,但当我选择取消对话时,我的CSS就会中断。

<p:dialog id="dlg" header="Bid" widgetVar="bidDialog" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
                <p:outputPanel id="bidDetail" style="text-align:center;">                       
                    <p:outputLabel value="You want to accept this bid?" />
                    <p:commandButton styleClass="ui-confirmdialog-yes" value="Yes" action="#{bidsBean.acceptBid()}"/>
                    <p:commandButton styleClass="ui-confirmdialog-no" value="No" onclick="dlg.hide()"/>
                </p:outputPanel>
            </p:dialog>

支持bean:

public String acceptBid() {
    repairService.acceptBid(selectedBid);
    FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage(null, new FacesMessage("Successful", "Bid successfully accepted!")); 
    repairBean.setSelectedRepair(null);
    return "repairs.xhtml";       
}

的CSS:

body {
font-size: 11pt; 

}

.narrow {
margin-left: 20%;
margin-right: 20%; 

}

隐藏对话框后,狭窄的样式表消失了。

1 个答案:

答案 0 :(得分:0)

primefaces的版本是什么?

如果是5.0版本 试试:

<p:confirmDialog header="Bid" severity="alert" widgetVar="dlg" showEffect="bounce" hideEffect="explode" global="true">
                        <p:commandButton value="Yes" actionListener="#{bidsBean.acceptBid}" oncomplete="PF('dlg').hide()" icon="ui-icon-check" ajax="true"/>
                        <p:commandButton value="No" onclick="PF('dlg').hide();" type="button" icon="ui-icon-close"/></p:confirmDialog>