无法重置/清除面板和数据表中的值-

问题描述 投票:0回答:1

我有一个表单,并且在表单中我有一个p:dialog-searchGameDetails.xhtml

Mainform.xhtml

            <h:form id="newApplication" enctype="multipart/form-data">

       </h:form>

    <p:dialog header="Game Search" widgetVar="gameSearch"  modal="true" appendTo="@(body)">
        <h:form id="gameSearchScreenForm">
            <p:panel id="gamesearchmodal" widgetVar="searchmodalpanel" styleClass="panelNoBorder">
                <ui:include src="/jsf/searchGameDetails.xhtml">     </ui:include>

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

searchGameDetails.xhtml

<p:panel id="searchscreen" widgetVar="searchmodalpanel">
    <h:panelGroup id="srchOpt">
        <h:panelGrid styleClass="panelGridBorderRemove" columns="5" cellpadding="7" style="font-weight:bold;width:100%;">

            <p:row>
                <p:column><p:outputLabel value="District"/></p:column>                      
                <p:column>
                    <p:selectOneMenu label=" Select District " id="district" value="#{searchGameBean.selectedDistrict}">
                            <f:selectItem itemLabel="Select District" itemValue="" />                       
                            <f:selectItems value="#{gameMB.districtList}" />
                    </p:selectOneMenu>
                </p:column>
            </p:row>


                <p:column>
                    <p:outputLabel value="Game Name" style="font-weight:bold" />
                    <p:message for="gameName" display="text" />
                    <p:inputText id="gameName" maxlength="20" size="25" value="#{searchGameBean.gameName}" />
                </p:column>

            <p:row>                     
                <p:column>
                    <p:commandButton id="searchButton" value="Search" widgetVar="searchB" actionListener="#{gameSearchMB.search}" update="gameSearchScreenForm">
                    <f:param name="param1" value="#{searchfor}" />
                    </p:commandButton>
                </p:column>

                <p:column>
                    <p:commandButton type="reset" value="Reset"  update="searchscreen" process="@this" actionListener="#{gameSearchMB.reset}"/>
                </p:column>

            </p:row>

        </h:panelGrid>

        <h:panelGrid columns="2" cellpadding="5">
            <p:dataTable id="searchTable"
                value="#{gameSearchMB.searchPageResultsList}"
                emptyMessage="No results found for search.">


                <p:column headerText="District" style="width:9%" sortBy="#{searchResultsRow.districtNumber}" filterBy="#{searchResultsRow.districtNumber}">
                    <h:outputText value="#{searchResultsRow.districtNumber}" />
                </p:column> 
                <p:column headerText="Game Name" style="width:9%" sortBy="#{searchResultsRow.gameName}" filterBy="#{searchResultsRow.gameName}">
                    <h:outputText value="#{searchResultsRow.gameName}" />
                </p:column>
            </p:dataTable>
        </h:panelGrid>

    </h:panelGroup>
</p:panel>

搜索功能运行良好,通过游戏名称搜索时,数据表将与searchPageResultsList一起显示。

实际发行/输出

我在重置按钮时遇到问题单击重置按钮后,

不清除值从字段中>>

 <p:inputText  , <p:selectOneMenu  and  datatable <p:dataTable

这是我尝试过的

                <p:column>
                    <p:commandButton type="reset" value="Reset"  update="searchscreen" process="@this" actionListener="#{gameSearchMB.reset}"/>
                </p:column>

public void reset() {
    logger.debug("Attempting to clear values in Datatable");
    RequestContext.getCurrentInstance().reset("panel:searchscreen");
    this.searchPageResultsList = null;
}

预期输出

单击复位按钮时,它必须清除输入值以及输出数据表

    <p:inputText  , <p:selectOneMenu  and  datatable <p:dataTable

我有一个表单,并且在表单中我有ap:dialog-searchGameDetails.xhtml Mainform.xhtml

forms jsf primefaces dialog reset
1个回答
0
投票
您是否尝试过使用primefaces组件resetInput吗?
© www.soinside.com 2019 - 2024. All rights reserved.