title: p-tablecheckbox and p-tableheadercheckbox
body: <p>I have a table which checkbox header and on checking the checkbox only few rows base on the condition need to be checked and on unchecking the box selected checks need to be disappear.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;p-table [value]="_rows" [columns]="columns" [(selection)]="selectedRows"&gt;
      &lt;p-tableHeaderCheckbox id="selectAllRows" (click)="selectRow()"&gt;&lt;/p-tableHeaderCheckbox&gt;
      &lt;p-tableCheckbox [value]="row" (click)="selectRow()" [disabled]="row.userDefined==='N'"&gt;
          &lt;/p-tableCheckbox
  &gt;&lt;/p-table&gt;
  </code></pre>
  
  <p>JS</p>
  
  <pre><code>selectRow() {
      this.selectedRows = this.selectedRows.filter(value =&gt; value.flag === 'Y');
      this.selectedEvent.emit(this.selectedRows);
  }
  </code></pre>