Events
The Pager emits the pageChange
and pageSizeChange
events.
Handling the Events
To process the data when the Pager current page is changed, handle the pageChange
event, which exposes the skip
and take
values that are necessary for obtaining the desired items.
The pageSizeChange
event is triggered when the user selects a new value from the PageSizes dropdown. If not prevented, it also triggers the pageChange
event with the new page size with a skip
value equal to 0
.
Preventing the PageSizeChange Event
In some scenarios it may prove useful to prevent the pageSizeChange
Pager event and to perform some custom logic.
The following example demonstrates how to open a confirmation dialog when the page size is greater than some arbitrary value, set by the developer, as displaying that many items may cause performance issues.