Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p-table [columns]="cols" [value]="cars" [(selection)]="selectedCars" dataKey="vin">
- <ng-template pTemplate="header">
- <tr>
- <th>Year</th>
- </tr>
- </ng-template>
- <ng-template pTemplate="body" let-car>
- <tr>
- <td>{{car.year}}</td>
- </tr>
- </ng-template>
- </p-table>
- export class TableDemo implements OnInit {
- cars: Car[];
- cols: any[];
- constructor() { }
- ngOnInit() {
- this.cars = [
- { vin: '123ABC', year: 1994 },
- { vin: '234BCD', year: 1978 },
- { vin: '345CDE', year: 2015 },
- ];
- this.cols = [
- { field: 'vin', header: 'Vin' },
- { field: 'year', header: 'Year' }
- ];
- }
- }
Add Comment
Please, Sign In to add comment