问题描述
我有一个问题,关于字典datatable。我建立了一个仪表板,人们可以在其中查找一些东西。所以在datatable中显示了数据库中的一些值。每一行都有一个按钮来获得更多的细节。所以如果你点击这个按钮,它会打开一个对话框,并提供一些更多的细节。数据表中的某些值显示在对话框中,还有一些显示在对话框中。所以这是正常工作。现在我发现过滤器在对话框中删除了我的值。当我使用过滤器功能时,他过滤我的值,更新和呈现新的datatable,当我点击按钮现在,对话框中的值已经消失。为什么? < h:form id =form1>
< p:dataTable value =#{auftragBean.auftragsDaten}var =auftrag
rowKey =#{auftragBean.auftragsDaten}selectionMode =single>
< f:facet name =header>
...
< / f:facet>
< p:column style =width:200px; text-align:center
filterBy =#{auftrag.schadennummer}headerText =Schadennummer
filterMatchMode =contains>
#{auftrag.schadennummer}
< / p:column>
< p:column headerText =Auftragsberichtstyle =text-align:center>
< p:commandButton styleClass =viewbuttonicon =ui-icon-search
style =border-left:1px solid#666; height:20px; font-size:10px;
oncomplete =PF('dlg')。show(); value =Open
actionListener =#{auftragBean.initSelectedData(auftrag)}
update =@ widgetVar(dlg)process =@ this>< / p:commandButton>
< / p:column>
< / p:dataTable> appendToBody =trueappendTo =@(body)modal =true
id =true
$ b&对话框resizable =false
header =Auftragsbericht& nbsp;& nbsp;& nbsp;#{auftragBean.auftragsData.jobId}
widgetVar =dlg showEffect =drophideEffect =drop>
< div style =max-height:1000px; padding-right:20px>
< p
style =margin-top:10px; color:black; font-size:16px; padding-bottom:0px; text-align:center;>
< b> Bearbeitungsverlauf< / b>
< / p>
< div class =berichtTabelle>
< h:form id =form2>
< p:dataTable
style =width:1300px; margin:0 auto; margin-top:20px; overflow:hidden
value =#{auftragBean.berichtsDaten}var =bericht
rowKey =#{bericht.tickerId}selectionMode =single>
< f:facet name =header>
< p:outputPanel style =height:20px>
< h:outputText value =Bearbeitungsverlauf
style =float:left; font-size:14px; />
< / p:outputPanel>
< / f:facet>
< p:column style =text-align:centerheaderText =Status>
#{bericht.status}
< / p:column>
< / p:dataTable>
< / h:form>
< / div>
< / div>
< / p:dialog> < / h:form>
我已经google了这个问题,但没有找到一个解决方案。可能有人可以帮助?
如果您过滤 dataTable
定义 filteredValue
属性 dataTable
,表示您过滤的数据。它应该与 dataTable
的值
属性相同。
Hi guys i have a problem, concerning the primefaces datatable. i built a dashboard, where people can look up some things. so in the datatable are shown some values from the database. every row got a button for more special details. so if you click on this button it opens a dialog frame with some more details. some of the values of the datatable are shown in the dialog and some more too. so this is working fine. now i figured out that the filter deletes my values in the dialog frame. when i use the filter function he filters my values, update and render the new datatable and when i click the button now, the values in the dialog frame are gone. why?
<h:form id="form1">
<p:dataTable value="#{auftragBean.auftragsDaten}" var="auftrag"
rowKey="#{auftragBean.auftragsDaten}" selectionMode="single">
<f:facet name="header">
...
</f:facet>
<p:column style="width:200px;text-align:center"
filterBy="#{auftrag.schadennummer}" headerText="Schadennummer"
filterMatchMode="contains">
#{auftrag.schadennummer}
</p:column>
<p:column headerText="Auftragsbericht" style="text-align:center">
<p:commandButton styleClass="viewbutton" icon="ui-icon-search"
style="border-left:1px solid #666; height:20px;font-size:10px;"
oncomplete="PF('dlg').show();" value="Open"
actionListener="#{auftragBean.initSelectedData(auftrag)}"
update="@widgetVar(dlg)" process="@this"></p:commandButton>
</p:column>
</p:dataTable>
<p:dialog appendToBody="true" appendTo="@(body)" modal="true"
id="dialog" resizable="false"
header="Auftragsbericht - #{auftragBean.auftragsData.jobId}"
widgetVar="dlg" showEffect="drop" hideEffect="drop">
<div style="max-height: 1000px; padding-right: 20px">
<p
style="margin-top: 10px; color: black; font-size: 16px; padding-bottom: 0px; text-align: center;">
<b>Bearbeitungsverlauf</b>
</p>
<div class="berichtTabelle">
<h:form id="form2">
<p:dataTable
style="width:1300px;margin:0 auto;margin-top:20px;overflow:hidden"
value="#{auftragBean.berichtsDaten}" var="bericht"
rowKey="#{bericht.tickerId}" selectionMode="single">
<f:facet name="header">
<p:outputPanel style="height:20px">
<h:outputText value="Bearbeitungsverlauf"
style="float:left;font-size:14px;" />
</p:outputPanel>
</f:facet>
<p:column style="text-align:center" headerText="Status">
#{bericht.status}
</p:column>
</p:dataTable>
</h:form>
</div>
</div>
</p:dialog> </h:form>
I have googled for this problem but havent found a solution. Maybe someone can help?
If you filter dataTable
, your should define filteredValue
attribute of dataTable
, which represents your filtered data. It should be the same type as value
attribute of this dataTable
.
这篇关于过滤数据后,原型会丢失对话框中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!