title: Angular2 primeNG Datatable filter data from external event
body: <p>I have an application that has one graph component and my idea is that when use clicks on a graph the correct filtering will occur on the other component which is an primeng data table</p>
  
  <p>for that end i've created an event and i can capture the event on the table component</p>
  
  <p>then i tried two approaches to filter the table correctly</p>
  
  <p>1.using ngModel, setting the value based on the event - not working</p>
  
  <pre><code>&lt;p-column field="result" [filter]="true" [style]="{'overflow':'visible'}" filterMatchMode="equals"&gt;
        &lt;ng-template let-col let-compliance="rowData" let-ri="rowIndex" pTemplate="body"&gt;
          &lt;span [ngClass]="{green: compliance.result=='SUCCESS', red: compliance.result=='FAILURE',
                          orange: compliance.result=='EXCLUDED', grey: compliance.result=='UNCHECKED'}"&gt;{{compliance.result}}&lt;/span&gt;
        &lt;/ng-template&gt;
        &lt;ng-template pTemplate="filter" let-col&gt;
          &lt;p-dropdown [options]="stationResults" [style]="{'width':'100%'}" appendTo="body"
           (onChange)="dt.filter($event.value,col.field,col.filterMatchMode)" styleClass="ui-column-filter" [(ngModel)]="selectedResult"&gt;&lt;/p-dropdown&gt;
        &lt;/ng-template&gt;
      &lt;/p-column&gt;
  </code></pre>
  
  <p>table is not being filtered</p>
  
  <p>later i tried a second approach</p>
  
  <p>2.add filters property to the datatable</p>
  
  <pre><code>this.stationService.upDownGraphEvent.subscribe(upDownEvent =&gt; {
        this.dt.filter(upDownEvent, 'result', 'equals');
        this.selectedResult = upDownEvent;
      });
  </code></pre>
  
  <p>in that case nothing happens</p>
  
  <p>is there a function i need to call on the dt to force it to recheck its filters?</p>
  
  <p>UPDATE ******</p>
  
  <p>I've tried the following code but without success</p>
  
  <pre><code>this.dt.filter(upDownEvent, 'result', 'equals');
        this.dt._filter();
        this.dt.updateDataToRender(this.dt.filteredValue);
  </code></pre>