santhosh
santhosh

Reputation: 3

How to avoid datatable to clear filter in columns on updating the datatable?

I have a datatable with columns, each columns having filter. I am using Lazy data model in order to populate the table.I am deleting the record from another form so i am updating the datatable inorder to remove the deleted record. But its clearing the filter in the column. Is there a way to avoid the datatable clearing filter but update the table ?

<p:dataTable id="leftTable" var="cmpny" value="#{companyBean.companyDataTableModel}" 
                emptyMessage="No Records Found" 
                filterDelay="1000"
                lazy="true">

                    <p:column headerText="Code" filterBy="#{cmpny.code}" sortBy="#{cmpny.code}"
                            style="width:5%;vertical-align:top;">
                        <h:outputText value="#{cmpny.code}"/>
                    </p:column>

                    <p:column headerText="Address1" filterBy="#{cmpny.mfgAddr1}" filterMatchMode="contains" sortBy="#{cmpny.mfgAddr1}"
                            style="width:10%;vertical-align:top;">
                        <h:outputText value="#{cmpny.mfgAddr1}"/>
                    </p:column>

Upvotes: 0

Views: 732

Answers (1)

WitYoBadSelf
WitYoBadSelf

Reputation: 98

You can use the sortField attribute on your dataTable. This is specific to lazy loading and is the:

Name of the field to pass lazy load method for sorting. If not specified, sortBy express is used to extract the name.

http://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml

Upvotes: 0

Related Questions