簡體   English   中英

JSF-PrimeFaces,如何僅刷新 <p:layoutUnit position=“center” > 而是全部 <p:layout> ?

[英]JSF-PrimeFaces, How to refresh only the <p:layoutUnit position=“center” > instead all <p:layout> ?

我有一個帶有layoutUnit west和layoutUnit center的布局,west的側面有一個菜單,該菜單調用另一個在中心側面渲染的頁面,問題是當在中心渲染另一個頁面時,所有布局都會刷新(west和center側面)。 我有以下代碼:

<p:layout style="width: 100%; height: 450px" >
                <p:layoutUnit position="west" size="230" collapsible="false" >
                    <h:form>                        

                        <p:menu style="font-size: 14px;  width: 95%;height: 420px " >
                            <p:submenu label="MENU">

                                <p:menuitem value="Students"  icon="ui-icon-arrowthick-1-n" url="pantallas/students.xhtml"  />    
                                <p:menuitem value="Teachers"  icon="ui-icon-refresh" url="pantallas/teacher.xhtml"  />


                            </p:submenu>


                        </p:menu>
                    </h:form> 

                </p:layoutUnit>

                <p:layoutUnit id="layout1" position="center" >
                    <h:form>
                        <ui:insert name="content" ></ui:insert>
                    </h:form>


                </p:layoutUnit>

            </p:layout>

和student.xhtml一樣:

<ui:composition template="../administracion.xhtml"
            xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://xmlns.jcp.org/jsf/html"
            xmlns:p="http://primefaces.org/ui"
            xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
            xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:define name="content">
    <h:head>
        <h:outputStylesheet library="css" name="styles2.css"/>
        <title>Facelet Title</title>
    </h:head>

    <h:body>
        <p:panel header="Student" style="width: 90%; margin: auto auto">
            <h:form id="forma1">
                <p:panel style="text-align: center">
                    <p:inputText placeholder="Students" value="#{datosCT.cct}"/>
                    <p:commandButton value="buscar" actionListener="#{controlCTAlumnos.traeInfo()}" update="panel1">
                        <f:ajax listener="#{controlCTAlumnos.mostrarPanel(e)}" render="panel1"  />
                    </p:commandButton>

                </p:panel>

            </h:form>
        </p:panel>

    </h:body>
</ui:define>

我看到並嘗試了許多方法來僅刷新layoutUnit中心,但在這種情況下不起作用。

有人能幫我嗎??

提前致謝。

您可以從內容頁面對布局單元內的表單組件進行部分更新。

<p:layoutUnit id="layout1" position="center" >
    <h:form id="form>
       <ui:insert name="content" ></ui:insert>
    </h:form>
</p:layoutUnit>

student.xhtml

<p:commandButton value="buscar" update=":form"/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM