I'm writing app in angular 8 with clarity.
I use datagrid with pagination. I need fetch data after change items per page but there is not any output from clarity components. There is only output for changing pages.
There is some html:
<clr-dg-footer>
<clr-dg-pagination #pagination [clrDgPageSize]="itemsPerPage" [clrDgTotalItems]="totalElements" [clrDgLastPage]="totalPages"
(clrDgPageChange)="onChangePage($event)">
<clr-dg-page-size [clrPageSizeOptions]="[5,20,50,100]" (change)="onItemsPerPageChange($event)">Samochodów na stronę</clr-dg-page-size>
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
z {{pagination.totalItems}} samochodów
</clr-dg-pagination>
</clr-dg-footer>
And there is how I'm doing it now:
onItemsPerPageChange(event) {
let newValue = +event.target.value.slice(3);
if(this.itemsPerPage !== newValue) {
this.itemsPerPage = newValue;
this.fetchCars();
}
}
It works but I know it's terrible way to do this.
Do you know how to do it in correct way? I don't have any ideas.