初始化p表值更改事件

时间:2019-10-22 02:01:56

标签: primeng primeng-table

当在primng 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>

1 个答案:

答案 0 :(得分:0)

代替:

<td pEditableColumn>

尝试:

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

开发者控制台应显示:

{field: "col3", data: <whatever you entered into the text box>}
相关问题