I want to click on a menu item, navigate to a different page that has a PrimeNG p-dataTable
, and scroll to the item on the p-dataTable
that the link corresponds to. (PrimeNG version being used is 4.0.3)
With this code, I am able to navigate to the new page correctly on both instances, with or without the item id,
http://localhost:4200/products?warehouseId=29 and http://localhost:4200/products/14?warehouseId=29
, but how do I get the table to scroll to the item ? Or does this particular PrimeNG p-datatable
not provide such functionality?
So for example my menu item has something like
<div *ngFor="let product of products">
<li>
<div>
<a [routerLink]="['/products', product.id]" [queryParams]="{ warehouseid: warehouse.id }">{{product.description}}</a>
</div>
</li>
</div>
<li>
<a [routerLink]="['/products']" [queryParams]="{ warehouseid: warehouse.id }">View All Products</a>
</li>
And p-dataTable has
<p-dataTable [value]="products" dataKey="id" #dt>
<p-column field="id" [style]="{ 'width': '0%' }" [hidden]="true">
<ng-template pTemplate="body" let-product="rowData">
<div>{{product.id}}</div>
</ng-template>
</p-column>
<p-column field="description" [style]="{ 'width': '50%' }" [sortable]="true">
<ng-template pTemplate="header">
<span>Description</span>
</ng-template>
<ng-template pTemplate="body" let-product="rowData">
<div>{{product.description}}</div>
</ng-template>
</p-column>
</p-dataTable>
Also, just in case, I am not allowed to use jQuery in this project.