title: Primefaces Datatable converter with filtering
body: <p>I have the <code>datatable</code> and <code>selectonemenu</code> inside it.<br>
  I want to show images in select one menu items.So a have Rating class and converter ratingConverter for Rating class.<br>
  I have the next problem here: filtering by this column works just once! When I try to change item, <code>method load(..)</code> from <code>LazyComicsDataModel</code> calls. But after
  filtering one time nothing worked! Method load not calls anymore. There are't any exceptions in <code>server.log</code>. When I don't use converter and class Rating (use just String class) it works right any number of times.
  I would like to get any ideas why it might be happened.<br>
  Code:<br>
  Part of xhtml page:<br>
      </p>
  
  <pre><code>            &lt;p:ajax 
                  event="rowSelect" 
  
                  update=":form:comicsDetail" 
                  oncomplete="PF('comicsDialog').show()"/&gt;
  
                  &lt;p:column width="20%" 
                        headerText="#{comicsCatalogueView.columnComicsRating}" 
                        sortBy="#{comics.rating}" 
                        filterBy="#{comics.rating}" 
                        filterMatchMode="exact" &gt;
                  &lt;f:facet name="filter" &gt;
                      &lt;p:selectOneMenu
  
                          value="#{comicsCatalogueView.rating}"
                          var="r"
                          onchange="PF('comicsTable').filter()"
                          converter="ratingConverter"
                          &gt;
  
                          &lt;f:selectItem 
                              value="#{null}"
                              itemValue="#{null}" /&gt; 
                          &lt;f:selectItems 
                              value="#{comicsFinderManagedBean.ratings}"
                              var="rating"
                              itemLabel="#{rating.value} - #{rating.value+1}"
                              itemValue="#{rating}" 
  
                                         /&gt;   
  
                          &lt;p:column&gt;
                              &lt;p:graphicImage value="#{r.image}"/&gt;
                          &lt;/p:column&gt;
  
                      &lt;/p:selectOneMenu&gt;
                  &lt;/f:facet&gt;
  
              &lt;h:panelGroup&gt;
                  &lt;pf:rating  disabled="true"
                              totalStars="5"
                              step="0.1"
                              value="#{comics.rating}"
                              &gt;
                  &lt;/pf:rating&gt;
              &lt;/h:panelGroup&gt;
  
              &lt;/p:column&gt;
  </code></pre>
  
  <p></p>
  
  <p>Rating class:</p>
  
  <pre><code>public class Rating {
  
  public Rating(Integer value, String image) {
      this.value = value;
      this.image = image;
  }
  
  private Integer value;
  private String image;
  
  public Integer getValue() {
      return value;
  }
  
  public void setValue(Integer value) {
      this.value = value;
  }
  
  public String getImage() {
      return image;
  }
  
  public void setImage(String image) {
      this.image = image;
  }
  
  @Override
  public int hashCode() {
      int hash = 5;
      hash = 71 * hash + (this.value != null ? this.value.hashCode() : 0);
      hash = 71 * hash + (this.image != null ? this.image.hashCode() : 0);
      return hash;
  }
  
  @Override
  public boolean equals(Object obj) {
      if (obj == null) {
          return false;
      }
      if (getClass() != obj.getClass()) {
          return false;
      }
      final Rating other = (Rating) obj;
      if (this.value != other.value &amp;&amp; (this.value == null || !this.value.equals(other.value))) {
          return false;
      }
      if ((this.image == null) ? (other.image != null) : !this.image.equals(other.image)) {
          return false;
      }
      return true;
  }
  
  @Override
  public String toString() {
      return "Rating{" + "value=" + value + ", image=" + image + '}';
  }
  </code></pre>
  
  <p>Rating converter:</p>
  
  <pre><code>@FacesConverter("ratingConverter")  
  public class RatingConverter implements Converter {
  
  @Override
  public Object getAsObject(FacesContext fc, UIComponent uic, String value) {
      if(value != null &amp;&amp; value.trim().length() &gt; 0) {
  
              ComicsFinderManagedBean ratingFinderManagedBean = (ComicsFinderManagedBean) 
                      fc.getExternalContext().getApplicationMap().get("comicsFinderManagedBean");
              return ratingFinderManagedBean.getRating(Integer.parseInt(value));
  
      }
      else {
          return null;
      }
  }
  
  @Override
  public String getAsString(FacesContext fc, UIComponent uic, Object object) {
      if(object != null) {
          return String.valueOf(((Rating) object).getValue());
  
      }
      else {
          return null;
      }
  }  
  </code></pre>
  
  <p>}</p>