I am attempting to load my data (pagination) dynamically using @pascalhonegger/ng-datatable, meaning I load the first page initially and then I'd like to call the API after the user tries to switch to the next page. However, the (onPageChange) event doesn't do anything. Am I missing something?
HTML template:
<table class="table table-striped table-hover table-responsive-lg" [mfData]="tableData" #mf="mfDataTable" [mfRowsOnPage]="10" (onPageChange)="doStuff($event)">
<thead>
<tr>
<th>
{{ 'COLUMN1' }}
</th>
<th>
{{ 'COLUMN2' }}
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of mf.data">
<td>{{ item.column1 }}</td>
<td>{{ item.column2 }}</td>
</tr>
</tbody>
</table>
My component contains the doStuff
method but all I do is currently log something to the console. This is where the API call for the next page would be, if the event worked, that is:
export class TerminalStandardComponent implements OnInit, AfterViewInit {
tableData: any[];
doStuff(ev) {
console.log(ev);
}
}
question from:
https://stackoverflow.com/questions/65908145/pascalhonegger-ng-datatable-onpagechange-isnt-triggered 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…