0
在我的JSF的兩個主要組件是p:樹和p:dataTable的過濾器阻止重置表值
的想法是根據樹節點選擇創建一個表。
JSF:
<h:panelGrid columns="2" style="width: 100%" columnClasses="treeColumn,tableColumn">
<h:panelGroup id="treePanel">
<p:tree id="tree"
value="#{genRepBean.root}"
var="node"
dynamic="true"
cache="true"
animate="true"
selectionMode="single"
selection="#{genRepBean.selectedNode}"
rendered="#{genRepBean.renderTree}">
<p:ajax event="select" listener="#{genRepBean.onNodeSelect}" update=":mainForm:tablePanel"/>
<p:treeNode expandedIcon="ui-icon-folder-open"
collapsedIcon="ui-icon-folder-collapsed">
<h:outputText value="#{node.name}" styleClass="tableTreeText"/>
</p:treeNode>
<p:treeNode type="au" icon="ui-icon-document">
<h:outputText value="#{node.name}" />
</p:treeNode>
</p:tree>
</h:panelGroup>
<h:panelGroup id="tablePanel">
<p:dataTable id="acqDataTable"
var="acq"
value="#{genRepBean.acqList}"
rendered="#{genRepBean.renderTable}"
filteredValue="#{genRepBean.filteredAcqList}"
paginator="true"
paginatorPosition="bottom"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10,15"
rows="10"
lazy="false"
style="width: 100%">
<p:column headerText="ID" sortBy="#{acq.Id}" styleClass="tableTreeText">
<h:outputText value="#{acq.Id}" />
</p:column>
<p:column headerText="IP ADDRESS" sortBy="#{acq.ipAddress}" styleClass="tableTreeText">
<h:outputText value="#{acq.ipAddress}"/>
</p:column>
<p:column headerText="STEP" sortBy="#{acq.Step}" filterBy="#{acq.Step}" filterMatchMode="contains" styleClass="tableTreeText">
<h:outputText value="#{acq.Step}"/>
</p:column>
<p:column headerText="STATUS" sortBy="#{acq.status}" filterBy="#{acq.status}" styleClass="tableTreeText">
<h:outputText value="#{acq.status}"/>
</p:column>
</p:dataTable>
這個bean(onNodeSelect):
public void onNodeSelect() {
acqList.clear();
this.acqList = AcqHelper.getAllViaStartDate(new java.sql.Date(startDate.getTime()));
if (!acqList.isEmpty()) {
DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("mainForm:acqDataTable");
dataTable.reset();
renderTable = true;
}
我不想刪除它,因爲非常實用到客戶端的過濾選項,但我不知道爲什麼其阻塞表刷新?
任何幫助將是巨大的
感謝
謝謝:) - clearFilters()很好 – angus
只要把這個線程作爲答案,不要忘記標記帖子爲答案。 –