2
votes

JSF-2.1 Primefaces 3.5 I have a datatable with Filter. I need to update only data on datatable(without Filter). Because everytime when i update the datatable, i lost the text in Filter Field.

I have one dialog, and the confirm button is outside the datatable's form How can i fix it?

Thanks

<h:form id="form">
<p:dataTable id="cm_dataTable_#{cc.clientId}" widgetVar="cm_dataTableWidget_#{cc.clientId}" var="adr" value="#{cc.attrs.addresses}"rowIndexVar="rowIndex" filterDelay="1000" binding="#{cc.dataTable}" rowKey="#{adr.mailingadresseid}" selection="#{mailingadressenBean.selectedAddresses}">           
<p:column id="colistuploadmeinedaten" filterBy="#{adr.firstname}" filterMatchMode="exact" filterOptions="#{mailingadressenBean.siTrueFalse}" sortBy="#{adr.istuploadmeinedaten}">
    <h:outputText value="#{adr.anrede}" />
</p:column>
</p:datatable>
</h:form>

and the Dialog's confirmbutton

<p:commandButton id="dm_yesBttn" value="#{langs.yes}" update=":form" actionListener="#{deleteMailingadresseBean.delete}"                    oncomplete="hideDeleteDialog(xhr, status, args)"/>
1
gives us code fragment, so we can help you - user2354035

1 Answers

5
votes

You can't (PrimeFaces 3.5) directly bind datatable filters with JSF bean, so they will not be preserved when you update the whole component.

But if you call filter() on datatable widget, the data will be reloaded from server, without re-rendering the whole datatable component (so the filters will be preserved)

<p:dataTable .... widgetVar="myTable"> ...</p:dataTable>

<p:commandButton action="#{myBean.doSth}" .... oncomplete="myTable.filter()"/>