无法重置/清除面板和数据表中的值 - <p:对话框



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

主窗体.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>

搜索游戏详情.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>

搜索功能工作正常,按游戏名称搜索时,数据表将与搜索页面结果列表一起显示。

实际问题/输出

我在使用重置按钮时遇到问题 单击重置按钮

不会清除字段中的值

<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

您是否尝试过使用素数组件 重置输入 ?

相关内容

  • 没有找到相关文章

最新更新