The sorting feature is provided by enabling the sortable property on each column. By default, the component supports single sorting (sortMode="single"). We can achieve multi sorting by setting sortMode="multiple". The DataTable component with the sorting feature to sort browser records in either ascending or descending order would be written as follows:
<p-dataTable [value]="browsers" (onSort)="onSort($event)">
<p-column field="engine" header="Engine" [sortable]="true">
</p-column>
<p-column field="browser" header="Browser" [sortable]="true">
</p-column>
<p-column field="platform" header="Platform" [sortable]="true">
</p-column>
<p-column field="grade" header="Grade" [sortable]="true">
</p-column>
</p-dataTable>
The following screenshot shows a snapshot...