Anton Styopin
Anton Styopin

Reputation: 753

Primefaces loses data in dialog after filter the 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 &nbsp;&nbsp;-&nbsp;&nbsp; #{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?

Upvotes: 0

Views: 1409

Answers (1)

Szarpul
Szarpul

Reputation: 1571

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.

Upvotes: 2

Related Questions