DataTable - Sort Simply enabling sortable property at column object is enough to make a column sortable.

export class DataTableSortDemo implements OnInit {

    cars: Car[];

    cols: Column[];

    constructor(private carService: CarService) { }

    ngOnInit() {
        this.carService.getCarsSmall().then(cars => this.cars = cars);

        this.cols = [
            {field: 'vin', header: 'Vin', sortable: true},
            {field: 'brand', header: 'Brand', sortable: true},
            {field: 'year', header: 'Year', sortable: true},
            {field: 'color', header: 'Color', sortable: true}
        ];
    }
}


<p-dataTable [value]="cars" [columns]="cols"></p-dataTable>