Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reset primeng datatable sort state?

I'd like to reset the sort state of primeng datable. i am able to reset full datatable but still sort state is not reset

like image 783
Nilesh007 Avatar asked Nov 09 '16 13:11

Nilesh007


1 Answers

This worked for me:

HTML

<p-table #table ...>

TS

import {Table} from 'primeng/table';

@ViewChild('table') table: Table;

resetSort() {
 this.table.sortOrder = 0;
 this.table.sortField = '';
 this.table.reset();
}
like image 176
Yonatan Ayalon Avatar answered Sep 19 '22 09:09

Yonatan Ayalon