'How can I get the value of 'rowsperpageOption selected' in p-table primeng

My question is regarding prime ng p-table. I need the value of rowsperpageoptions. my html code is : <p-table (onPage)="paginate($event)" [(first)]="first" [paginator]="true" [rows]= "rows" [rowsPerPageOptions]='["30","20","10"]'>

in typescript i am assigning rows like: rows = 30;

but I want to get the rowsperpage whenever the user changes the option from 30 to 20 or 10. e.g, if the user changes the rows from 30 to 20. then the value of row becomes 20.

Can anybody help in this?



Solution 1:[1]

<p-table (onPage)="paginate($event)" [(first)]="first" [paginator]="true" [(rows)]= "rows" [rowsPerPageOptions]='["30","20","10"]'>

Use two-way binding with [()] syntax (also known as 'banana-in-a-box syntax'), the value in the UI always syncs back to the domain model in your class.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rajesh K