Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refresh the data and paginator state

I am using PrimeNG Turbotable <p-table #dt.

According this dt.reset() will reset sort, filter and paginator state. I am trying to find a way to reset paginator state and reload table data. (without the sort state reset)

This should happen on (click) of that button enter image description here

<p-button icon="fa fa-refresh" (click)="refresh()"></p-button>

How can I achieve that ?

like image 841
E.Meir Avatar asked Jun 07 '26 09:06

E.Meir


1 Answers

In .html file -

<p-table #dt [columns]="cols" [value]="result" [paginator]="true" [rows]="10" [(first)]="first">

Don't forget the brackets in [(first)]

In .ts file, Add first attribute :

first = 0

wherever you want to reset, call below mentioned refresh function

refresh() {
    this.first = 0;
}
like image 58
harsh tibrewal Avatar answered Jun 09 '26 01:06

harsh tibrewal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!