Richfaces datatable, filter works in unexpected way
jeroenvanveghel May 16, 2013 5:43 AMHi,
My problem is very strange to me.
Im looking for a rich datatable (or extendeddatatable, it does not really matter for me) which can filter certain columns.
From the richfaces showcase i followed the extended datatable example and explicitly for the vendor column.
You can find the example here: Showcase example
I made the filter work eventually, but all of a sudden there is a input text field below the selectbox to filter.
That input field should not be there, because i have no use for it. Can someone help me out to get rid of this?
The attached image can show you what happened.
my .xthml code:
<rich:extendedDataTable value="#{AddAttribuutPB.allDocuments}" var="doc" id="table" style="height:300px; width:500px;" selectionMode="none"> <f:facet name="noData"> Nothing found </f:facet> <rich:column filter="#{DocumentenFilteringBean.filterVendor}" > <f:facet name="header"> <h:panelGroup> <h:outputText value="Soort "/> <h:selectOneMenu value="#{DocumentenFilteringBean.vendorFilter}"> <f:selectItems value="#{AddAttribuutPB.DocumentSoortOptions()}" var="docsoort" itemLabel="#{docsoort.document_soort_omschrijving}" itemValue="#{docsoort.document_soort_omschrijving}"/> <a4j:ajax render="table" execute="@this" event="change"/> </h:selectOneMenu> </h:panelGroup> </f:facet> <h:outputText value="#{doc.document_soort.document_soort_omschrijving}" /> </rich:column> <rich:column> <f:facet name="header"> <h:outputText value="Naam"/> </f:facet> <h:outputText value="#{doc.document_naam}"/> </rich:column> </rich:extendedDataTable>
My DocumentenFilteringBean.java:
@ManagedBean(name="DocumentenFilteringBean") @SessionScoped public class DocumentenFilteringBean implements Serializable { /** * */ private static final long serialVersionUID = -5680001353441022183L; private String vendorFilter; public Filter<?> getFilterVendor() { return new Filter<Document>() { public boolean accept(Document t) { String vendor = getVendorFilter(); if (vendor == null || vendor.length() == 0 || vendor.equals(t.getDocument_soort().getDocument_soort_omschrijving())) { return true; } return false; } }; } public String getVendorFilter() { return vendorFilter; } public void setVendorFilter(String vendorFilter) { this.vendorFilter = vendorFilter; } }
I know i didn't follow the code example exactly, but otherwise the getFilterVendor() wouldn't even get called!
Thanks in advance
-
datatable_filter.JPG 13.2 KB