title: primefaces - datatable filter
body: <p>I'm trying to do a filter in a datatable (primefaces 3.5). The filter should only be fired when the user clicks on a commandLink.</p>
  
  <pre><code>&lt;h:commandLink title="#{open}"
  onclick="$('#form\\:filteredTable\\:statusColumn_filter').val('OPEN'), filteredTable.filter()"&gt;
  &lt;h:graphicImage name="16x16.png" styleClass="ico" /&gt;
  &lt;/h:commandLink&gt;
  </code></pre>
  
  <p>My table:</p>
  
  <pre><code>&lt;h:form id="form"&gt;
      &lt;h:panelGroup&gt;
          &lt;div&gt;
              &lt;p:dataTable widgetVar="filteredTable" var="y" value="#{x}" rendered="#{w.showFilterButtons}" filteredValue="#{w.filteredX}"&gt;
                  &lt;p:column id="statusColumn" headerText="label"
                      filterBy="#{y.status}" filterMatchMode="exact"
                      filterStyle="display:none;"
                      filterOptions="#{w.statuses}"&gt; 
                      &lt;h:outputText value="#{y.status.name}"/&gt;
                  &lt;/p:column&gt;
              &lt;/p:dataTable&gt;
          &lt;/div&gt;
      &lt;/h:panelGroup&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>I have 3 problems with this code:</p>
  
  <p>1 - The filter does not work. If I click on the commandLink, the pages reloads but nothing was filtered. Probabily because #form\:filteredTable\:statusColumn_filter').val() returns undefined. So I guess I'm not setting the value to do the filter (right?)</p>
  
  <p>2 - I want to do a default filter, so when the datatable loads the first time it would be already filtered by a status.</p>
  
  <p>3 - This datatable is inside a pop up in google maps. But when I click on the commandLink, the whole page reloads, so the pop up is "closed", the map goes back to the initial zoom. This way, the user will have to zoom again, click on the marker in the map to open the pop up again to see the filtered data. This is not good. There is a way to only reload the datatable?</p>