title: Filter a lazy dataTable with dynamic columns
body: <p>I have a dataTable with dynamic Columns:</p>
  
  <pre><code>&lt;p:dataTable id="bookings" var="booking" value="#{tableBean.dataModel}" 
      widgetVar="bookingTable" filteredValue="#{tableBean.filteredFields}"
      paginator="true" rows="15"
      lazy="true" rowsPerPageTemplate="15,30,50" type="none" draggableColumns="true"&gt;
  
  [...]
  
  &lt;p:columns value="#{tableBean.columns}" var="column" columnIndexVar="colIndex"
             sortBy="#{booking.properties[column.property]}"
             filterBy="#{booking.properties[column.property]}"
             filterMatchMode="in"
             styleClass="telegrotesk"&gt;
      &lt;f:facet name="header"&gt;
          &lt;h:outputText value="#{column.header}"/&gt;
      &lt;/f:facet&gt;
      &lt;f:facet name="filter"&gt;
          &lt;p:selectCheckboxMenu label="#{column.header}" onchange="PF('bookingTable').filter()"&gt;
              &lt;f:selectItems value="#{column.possibilities}" /&gt;
          &lt;/p:selectCheckboxMenu&gt;
      &lt;/f:facet&gt;
      &lt;h:outputText value="#{booking.properties[column.property]}"/&gt;
  &lt;/p:columns&gt;
  </code></pre>
  
  <p>column is similar like in the primefaces example (<a href="http://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml" rel="nofollow">http://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml</a>) this class:</p>
  
  <pre><code>static public class ColumnModel implements Serializable {
  
      private String header;
      private String property;
      private List&lt;SelectItem&gt; possibilities;
  
      public ColumnModel(Field property) {
          this.header = property.getName();
          this.property = property.getSqlName();
      }
  
      public String getHeader() {
          return header;
      }
  
      public String getProperty() {
          return property;
      }
  
      public List getPossibilities() {
          return possibilities;
      }
  
      public void setPossibilities(List&lt;SelectItem&gt; possibilities) {
          this.possibilities = possibilities;
      }
  }
  </code></pre>
  
  <p>In my example there is for testing only one dynamic column, that shows the User that created a booking. It works, that in the checkboxdropdown are shown all users. When I select one or more users, the function load</p>
  
  <pre><code>public List&lt;Booking&gt; load(int first, int pageSize, String sortField, SortOrder sortOrder, Map&lt;String,Object&gt; filters) {
      [...]
  }
  </code></pre>
  
  <p>is executed, but filters is always empty!</p>
  
  <p>The list possibilities in the <code>ColumnModel</code> is a Collection of <code>SelectItems</code>. The label is always the username, the value the User object. For the user class I defined a Converter class implementing <code>javax.faces.convert.Converter</code> with the <code>@FacesConverter(forClass = User.class)</code></p>
  
  <p>What am I doing wrong that the filter map is always empty?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>When I do it like this</p>
  
  <pre><code>&lt;p:columns value="#{tableBean.columns}" var="column" columnIndexVar="colIndex"
             sortBy="#{booking.properties[column.property]}"
             filterBy="#{booking.properties[column.property]}"
             filterMatchMode="in"
             filterOptions="#{column.possibilities}"
             styleClass="telegrotesk"&gt;
  </code></pre>
  
  <p>and with no facet it works correctly but I can only select one User.</p>
  
  <p>I'm using primefaces 5.0, jsf 2.2.1 and glassfish v4</p>