【问题标题】:Primefaces panels appear open when collapsed is set to truePrimefaces 面板在折叠设置为 true 时显示为打开
【发布时间】:2016-05-10 17:26:22
【问题描述】:

默认情况下,当页面加载时,面板显示为关闭,因为我有属性 collapsed="true"。我希望当我自动编辑添加面板更新时,更新工作正常,但所有面板都显示为打开,即使我已折叠设置为 true。我不知道为什么会这样。有谁知道为什么?以及如何解决这个问题?

addView.xhtml:

<body>
    <h:outputStylesheet name="./../../resources/css/cssLayout.css"/>
    <ui:composition template="./../../Layouts/LayoutGeneral.xhtml">
        <ui:define name="content">
            <h1 style="text-align: center">Adds</h1> <br/>

            <h:form id="allAddsId">
                <ui:repeat value="#{addBean.allAdds}" var="add" >
                    <p:panel id="basic" header="#{add.title}" style="margin-bottom:20px" toggleable="true" collapsed="true" styleClass="">
                        <p:ajax event="toggle"/>
                        <h:panelGrid columns="2" style="width:100%">
                            <p:outputLabel value="#{add.description}" />
                        </h:panelGrid> <br/>

                        <p:separator/>
                        <p:commandButton value="Edit"  oncomplete="PF('detail').show();" update="detailAdd" action="#{addBean.setAddAux(add)}"/>

                        <p:growl id="growl" showDetail="true" sticky="false" />
                    </p:panel>
                </ui:repeat>
            </h:form>  

            <p:dialog id="detail" header="Edit Add" widgetVar="detail">
                <p:outputPanel id="detailAdd">
                    <h:form>
                        <p:outputLabel value="Title"/><br/>
                        <p:inputTextarea id="titleEdit" value="#{addBean.addAux.title}" rows="2" cols="50" counter="displayTE" maxlength="50" counterTemplate="{0} caracteres restantes" autoResize="false" required="true" requiredMessage="Title necesaria"/> <br/>
                        <p:outputLabel id="displayTE"/> <br/> <br/>

                        <p:outputLabel value="Description"/> <br/>
                        <p:inputTextarea id="opcion1" value="#{addBean.addAux.description}" rows="6" cols="50" counter="displayDE" maxlength="200" counterTemplate="{0} caracteres restantes" autoResize="false" required="true" requiredMessage="Description necesaria"/> <br/>
                        <p:outputLabel id="displayDE"/> <br/> <br/>

                        <p:separator/> <br/>
                        <h:panelGrid columns="1">
                            <p:commandButton value="Save" action="#{addBean.editAdd(addBean.addAux)}" onclick="detail.hide()" update=":allAddsId"/>
                        </h:panelGrid>  
                    </h:form>
                </p:outputPanel>
            </p:dialog>

        </ui:define>
    </ui:composition>
</body>

【问题讨论】:

    标签: jsf primefaces xhtml panel


    【解决方案1】:

    好的,我找到了解决方案!我不知道这是否是最好的答案,但我走了..

    我正在做 somo 测试,我删除了面板声明下的 p:ajax event="toggle",现在可以使用了!!当我编辑添加时,添加列表会自动更新,并且面板显示为折叠!我不知道为什么删除它会起作用,所以如果有人知道,请随时告诉我!

    希望这对某人有所帮助!

    【讨论】:

    • 请在问题中说明您的 PF 版本
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    • 1970-01-01
    • 2021-01-20
    • 2018-06-12
    • 1970-01-01
    相关资源
    最近更新 更多