I'm getting the data from the API, and rendering it in p-table
Right after that I'm triggering the table filtering programmatically (default filter).
The problem I'm facing is that the Table is loaded and rendered without filter, and in few ms later filter is applied, and table re-rendered.
Is there a way to get the event which triggers the loading of Prime Table? Or delay it somehow.
Template:
<p-table #tt class="table"[value]="myList">
....
<tr>
<th>
<p-dropdown appendTo="body" *ngSwitchCase="'state'" [options]="states"
(onChange)="tt.filter($event.value, 'state', 'equals')"></p-dropdown>
</th>
</tr>
....
</p-table>
Class:
export class Component implements {
@ViewChild('tt') tt: DataTable;
myList: any;
getList(){
Promise.resolve(...)
.then(res => {
this.myList = res;
this.tt.filter('created', 'state', 'equals');
});
}
}