<p-cellEditor style="width: 100%;">
<ng-template pTemplate="input">
<p-inputNumber [(ngModel)]="object.amount" name="chargedAmount" mode="currency"
currency="PHP" [disabled]="disableFieldEdit"></p-inputNumber>
</ng-template>
<ng-template pTemplate="output">
{{ object.amount | currency: 'PHP'}}
</ng-template>
</p-cellEditor>
我已经添加了disableFieldEdit,问题是字段显示不可见,因为禁用为灰色。我需要单击该字段才能查看其是否已禁用
您无法禁用
p-cellEditor
,您应该使用 ngIf
指令,以便在单元格可编辑的情况下显示 p-cellEditor
,否则您将显示静态单元格
<p-cellEditor style="width: 100%;" *ngIf="canEditCell;else staticCell">
<ng-template pTemplate="input">
<p-inputNumber [(ngModel)]="object.amount" name="chargedAmount" mode="currency"
currency="PHP" [disabled]="disableFieldEdit"></p-inputNumber>
</ng-template>
<ng-template pTemplate="output">
{{ object.amount | currency: 'PHP'}}
</ng-template>
</p-cellEditor>
<ng-template #staticCell>
{{ rowData[col.field] }}
</ng-template>