I'm using a PrimeNG TurboTable component on an Angular 7 application and there's a button to add new rows to it. The problem is that, when a new row is added, the user has to scroll down to the bottom of the table to start editing it. How could I scroll to it?
This is how I define the table in the template:
<p-table [value]="gridOptions" [scrollable]="true" scrollHeight="13em"
selectionMode="single" [(selection)]="selectedOption"
(onEditComplete)="onDataChanged($event)"
(onRowReorder)="onDataChanged($event)">
[ ... ]
</p-table>
And this is the 'Add option' handler:
onAddOption() {
// This adds a new option to the TurboTable
this.gridOptions.push({ name: "", arg: "", comment: "", scope: this.scope });
// I expected that selecting an option would scroll to it, but it doesn't work
this.selectedOption = this.gridOptions[this.gridOptions.length-1];
}
Any ideas? Thanks!