Я изменяю свою таблицу на основе значения, выбранного в dropDown.
Когда я изменяю значение через dropDown, я получаю сообщение Не удается повторно инициализировать ошибку DataTable.
getResults(input) {
this.suiteResults = [];
this.suitService.getAllSuite(clientID).subscribe(r => {
this.suiteResults = <any[]>r;
// Calling the DT trigger to manually render the table
this.dtTrigger.next();
console.log("getAllSuite response r is :" + JSON.stringify(this.suiteResults));
});
}
............
ngOnDestroy(): void {
// Do not forget to unsubscribe the event
this.dtTrigger.unsubscribe();
}
ngOnInit() {
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 10
};
this.dtTrigger.next();
}
<select name="selectedClient" [(ngModel)]="selectedClient" (change)="getResults(selectedClient)">
<option *ngFor="let client of clientList" [ngValue]="client">{{client}}</option>
</select>
</div>
</div>
<div class="row-fluid" id="rowPadding">
<div class="col-12 colBorder">
<table datatable [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" class="table table-striped" >
<thead>
<tr>
<th *ngFor="let heading of headers">{{heading}}</th>
</tr>.....................................................................................................
this.dtTrigger.next () вызывается в getResults и в ngOnInit ... что мне делать, чтобы при изменении dropDown я не получал ошибку повторной инициализации