Hi,
I am using version 21.1.0 of ngx-datatable.
Looks like that some behavior related to the page callback was changed.
In version 20.1.0 and older this callback was called only when the user interacts with the pager, instead now gets called even during initialization and on sort (see: #2235).
@Component({
selector: 'client-paging-demo',
template: `
<ngx-datatable
class="material"
[rows]="rows"
[columns]="[{ name: 'Name' }, { name: 'Gender' }, { name: 'Company' }]"
[columnMode]="ColumnMode.force"
[headerHeight]="50"
[footerHeight]="50"
rowHeight="auto"
(page)="onPageChange($event)"
[limit]="10"
>
</ngx-datatable>
`,
standalone: false
})
export class ClientPagingComponent {
rows: Employee[] = [];
ColumnMode = ColumnMode;
constructor() {
this.fetch(data => {
this.rows = data;
});
}
fetch(cb) {
const req = new XMLHttpRequest();
req.open('GET', `assets/data/company.json`);
req.onload = () => {
cb(JSON.parse(req.response));
};
req.send();
}
onPageChange($event: any): void {
console.log('pageChange!');
}
}
I think correct behavior should be to call it only when the user interact with the pager.
Hi,
I am using version 21.1.0 of
ngx-datatable.Looks like that some behavior related to the page callback was changed.
In version 20.1.0 and older this callback was called only when the user interacts with the pager, instead now gets called even during initialization and on sort (see: #2235).
I think correct behavior should be to call it only when the user interact with the pager.