0

当primeng p表上的任何可编辑单元格值发生更改时,我正在尝试调用该方法。我尝试使用 onEditComplete 事件,但它只会在我编辑单元格并按 Enter 时触发。当我编辑单元格并移出鼠标时,它不会触发。谁能建议我应该在这里添加的正确事件是什么?

<p-table [value]="sampleData" [scrollable]="true" scrollHeight="200px" [resizableColumns]="true"
            (onEditComplete)="getLandLineTotal($event)">
            <ng-template pTemplate="header">
                <tr>
                    <th>Col 1</th>
                    <th>Col 2</th>
                    <th>Col 3</th>
                </tr>
            </ng-template>
            <ng-template pTemplate="body" let-rowData>
                <tr>
                    <td style="width: 10%">
                        {{rowData.col1}}
                    </td>
                    <td>
                        {{rowData.col2}}
                    </td>
                    <td pEditableColumn>
                        <p-cellEditor>
                            <ng-template pTemplate="input">
                                <input pInputText type="text" [(ngModel)]="rowData.col3"  required>
                            </ng-template>
                            <ng-template pTemplate="output">
                                {{rowData.col3| currency}}
                            </ng-template>
                        </p-cellEditor>
                    </td>
                </tr>
            </ng-template>
        </p-table>
4

1 回答 1

0

代替:

<td pEditableColumn>

尝试:

<td [pEditableColumn]="sampleData.col3" [pEditableColumnField]="'col3'">

开发者控制台应显示:

{field: "col3", data: <whatever you entered into the text box>}
于 2019-12-07T05:12:34.363 回答