I'm trying to use DataTableModule to show a list of data and when click one row , routing to a component to show the detail of this row.
I finished the data listing part. But stuck on showing detail part.
How should I detect the click event of one row in DataTableModule ?
The code from demo is like below:
Code: Select all
<div class="ui-g-12">
<div class="card card-w-title">
<h1>DataTable</h1>
<p-dataTable [value]="cars1" selectionMode="single" [(selection)]="selectedCar"
[paginator]="true" [rows]="10" [responsive]="true">
<p-header>List of Cars</p-header>
<p-column field="vin" header="Vin" [sortable]="true"></p-column>
<p-column field="year" header="Year" [sortable]="true"></p-column>
<p-column field="brand" header="Brand" [sortable]="true"></p-column>
<p-column field="color" header="Color" [sortable]="true"></p-column>
</p-dataTable>
</div>
</div>