我在更新panelgrid列时遇到问题 下面是我的xhtml文件中的代码,在treatmenthistory.xhtml中的数据表更新正常,但searchresult.xhtml没有更新,你必须刷新整个页面,使其更新。那么问题是什么,两个xhtml页面看起来都一样,它们都有数据表。
<h:form>
<p:panelGrid cellpadding="0" styleClass="results">
<p:row>
<p:column colspan="1">
<ui:include src="/searchresult.xhtml" />
</p:column>
<p:column colspan="1">
<ui:include src="/treatmenthistory.xhtml" />
</p:column>
</p:row>
</p:panelGrid>
</h:form>
用户:
<ui:composition xmlns="w3.org/1999/xhtml" xmlns:f="java.sun.com/jsf/core" xmlns:h="java.sun.com/jsf/html" xmlns:ui="java.sun.com/jsf/facelets" xmlns:p="primefaces.org/ui">
<p:dataTable id="users" var="user1" styleClass="searchResult"
widgetVar="userTable" value="#{KisiInfoProcess.kisiList}"
emptyMessage="#{msg['noRecordsFound']}" dynamic="true"
paginator="true" rows="10" rowKey="#{user1.tcidno}"
rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'highlight1' : 'highlight2'}"
rowIndexVar="rowIndex" selection="#{KisiInfoProcess.selectedOS}"
selectionMode="single" paginatorPosition="bottom">
<p:ajax event="rowSelect" listener="#{KisiInfoProcess.onRowSelect}"
process="@this" update=":form:users2" />
<f:facet name="header">
<h:outputText value="#{msg['searchResultsPanel']}" />
</f:facet>
<p:column id="kisiid" sortBy="#{user1.kisiid}"
filterBy="#{user1.kisiid}" styleClass="kisiid">
<h:outputText value="#{user1.kisiid}" />
<p:watermark for="@(.kisiid)" value="#{msg['protocolNo']}" />
</p:column>
<p:column id="ad" sortBy="#{user1.ad}" filterBy="#{user1.ad}"
styleClass="ad">
<h:outputText value="#{user1.ad}" />
<p:watermark for="@(.ad)" value="#{msg['name']}" />
</p:column>
<p:column id="soyad" sortBy="#{user1.soyad}"
filterBy="#{user1.soyad}" styleClass="soyad">
<h:outputText value="#{user1.soyad}" />
<p:watermark for="@(.soyad)" value="#{msg['surname']}" />
</p:column>
<p:column sortBy="#{user1.tcidno}" styleClass="tcidno"
filterBy="#{user1.tcidno}" id="tcidno">
<h:outputText value="#{user1.tcidno}" />
<p:watermark for="@(.tcidno)" value="#{msg['identityNumber']}" />
</p:column>
<p:column sortBy="#{user1.ogrencino}" styleClass="ogrencino"
filterBy="#{user1.ogrencino}" id="ogrencino">
<h:outputText value="#{user1.ogrencino}" />
<p:watermark for="@(.ogrencino)" value="#{msg['studentNumber']}" />
</p:column>
<p:column sortBy="#{user1.dogumtarihi}" styleClass="dogumtarihi"
filterMatchMode="contains" filterBy="#{user1.dogumtarihi}"
id="dogumtarihi">
<h:outputText value="#{user1.dogumtarihi}">
<f:convertDateTime type="date" pattern="dd/MM/yyyy" />
</h:outputText>
<p:watermark for="@(.dogumtarihi)" value="#{msg['dateOfBirth']}" />
</p:column>
<f:facet name="footer">
<p:commandButton id="modalDialogButton" style="min-width:8%"
value="#{msg['newPatient']}"
action="#{KisiInfoProcess.resetHastakayit}" update=":form:basic"
oncomplete="PF('dlg2').show()" />
</f:facet>
</p:dataTable>
</ui:composition>
users2:
<ui:composition xmlns="w3.org/1999/xhtml" xmlns:f="java.sun.com/jsf/core" xmlns:h="java.sun.com/jsf/html" xmlns:ui="java.sun.com/jsf/facelets" xmlns:p="primefaces.org/ui">
<p:growl id="msgs" showDetail="true" />
<p:dataTable id="users2" var="user" styleClass="patienthistory"
emptyMessage="#{msg['noRecordsFound']}" widgetVar="muayeneTable"
value="#{KisiInfoProcess.muayeneList}" dynamic="true"
selection="#{KisiInfoProcess.selectedOS}" paginator="true" rows="10"
rowKey="#{user.muayeneid2}"
rowStyleClass="#{(rowIndex mod 2) eq 0 ? 'highlight1' : 'highlight2'}"
rowIndexVar="rowIndex" selectionMode="single"
paginatorPosition="bottom">
<p:ajax event="rowSelect"
listener="#{KisiInfoProcess.onRowSelectMuayene}" process="@this"
update=":form:panel2,:form:protocolNo"
oncomplete="PF('dlg3').show()" />
<f:facet name="header">
<h:outputText value="#{msg['treatmentHistoryPanel']}" />
</f:facet>
<p:column sortBy="#{user.muayeneid2}" styleClass="muayeneid"
filterBy="#{user.muayeneid2}" id="muayeneno2">
<h:outputText value="#{user.muayeneid2}" style="width:5%" />
<p:watermark for="@(.muayeneid)" value="#{msg['treatmentNo']}" />
</p:column>
<p:column sortBy="#{user.muayeneturuid2}" styleClass="muayeneturu"
filterBy="#{user.muayeneturuid2}" id="muayeneturuid2">
<h:outputText value="#{user.muayeneturuid2}" style="width:5%" />
<p:watermark for="@(.muayeneturu)" value="#{msg['treatmentType']}" />
</p:column>
<p:column sortBy="#{user.tarih}" styleClass="tarih"
filterMatchMode="contains" filterBy="#{user.tarih}" id="tarih">
<h:outputText value="#{user.tarih}" style="width:5%">
<f:convertDateTime type="both" pattern="dd/MM/yyyy - HH:mm" />
</h:outputText>
<p:watermark for="@(.tarih)" value="#{msg['treatmentDate']}" />
</p:column>
<p:column sortBy="#{user.islemiyapan}" styleClass="islemiyapan"
filterMatchMode="contains" filterBy="#{user.islemiyapan}"
id="userid2">
<h:outputText value="#{user.islemiyapan}" style="width:5%" />
<p:watermark for="@(.islemiyapan)" value="#{msg['treatmentDoctor']}" />
</p:column>
<p:column id="tanivarmi">
<h:outputText style="width:5%" value="#{user.taniVarmi2}" />
</p:column>
<f:facet name="footer">
<p:commandButton id="modalDialogButton2" style="min-width:8%"
rendered="#{KisiInfoProcess.kisiSelected}"
value="#{msg['newTreatment']}"
action="#{KisiInfoProcess.resetMuayene}" update=":form:basic2"
oncomplete="PF('dlg3').show()" />
</f:facet>
</p:dataTable>
</ui:composition>
答案 0 :(得分:1)
<p:panelGrid cellpadding="0" styleClass="results" id="someID">
然后当您采取某些措施来更改数据表时,请设置Update =&#34; someID&#34;刷新两个页面。 SomeID是你的完整id&#34; someNameContainer:someID&#34;
如果你有一个动作来更新两个表,请不要忘记tu put process =&#34; idfirstTatbe idSecondTable&#34;在更新之前处理它们。
答案 1 :(得分:0)
我解决了自己的问题,我删除了
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("PF('userTable').clearFilters()");
现在我还有另一个问题需要清除数据表过滤器
@DijanaCukic感谢Dijana花时间解决我的问题