I've got a PrimeNG p-table with a number of columns and rows, one column uses an input as its cell editor. Compact version below:
<p-table [value]="rowDatas" selectionMode="single" [(selection)]="selectedRowData">
<ng-template pTemplate="body" let-rowData let-rowIndex="rowIndex">
<tr [pSelectableRow]="rowData">
<td pEditableColumn>
<p-cellEditor>
<ng-template pTemplate="input">
<input id="{{'hours' + rowIndex}}" pInputText type="text" [(ngModel)]="rowData.hours">
</ng-template>
<ng-template pTemplate="output">
{{rowData.hours}}
</ng-template>
</p-cellEditor>
</td>
</ng-template>
I have access to the table using ViewChild
@ViewChild(Table) private table: Table;
But I have no idea where to go from there. The PrimeNG documentation does not give a hint how to trigger cell edit programmatically. Googling it is throwing something out there with EditableColumns and onClick, but that does not work, and skips which rows should be edited.
I am able to identify the input field via an ID, if it were present. But the actual input HTML tag is only added if the cell is put in edit mode. So I cannot use the standard getElementById.focus.
How do I start editing a specific cell using PrimeNG p-table?