Sujeet Raman

Sujeet Raman

  • 859
  • 927
  • 351.9k

how to disable edit button based on column value

May 4 2018 8:20 AM
in my data table(using PrimeNg for angular 2)i have a coloumn name Ispublished.If Ispublishd is true need to disable the editbutton and change the color of the row.. how i can achive it?
 
<p-dataTable [value]="weightsegment" resizableColumns="true" selectionMode="single" [(selection)]="selectedCar" [responsive]="true" [rows]="4" [paginator]="true" #dt>
<p-column field="isPublished" header="isPublished " [sortable]="false"></p-column>
<p-column field="CreatedBy" header="CreatedBy" [sortable]="false" [filter]="false" filterPlaceholder="Search"></p-column>
<p-column field="CreatedOn" header="CreatedOn " [sortable]="false" [style]="{'width':'200px'}" [filter]="false" filterPlaceholder="Search">
<ng-template let-row="rowData" pTemplate="body">
{{row.CreatedOn | date}}
</ng-template>
</p-column>
<p-column field="UpdatedBy" header="UpdatedBy " [sortable]="false" [filter]="false" filterPlaceholder="Search"></p-column>
<p-column field="UpdatedOn" header="UpdatedOn" [sortable]="false" [style]="{'width':'200px'}" [filter]="false" filterPlaceholder="Search">
<ng-template let-row="rowData" pTemplate="body">
{{row.UpdatedOn | date}}
</ng-template>
</p-column>
<p-column header="Edit">
<ng-template let-col let-carT="rowData" pTemplate type="body">
<button type="button" pButton icon="fa-edit" [disabled]="showpublishbutton" pTooltip="edit this row" tooltipPosition="top" (click)="showDialogToEdit(carT)"></button>
</ng-template>
</p-column>
</p-dataTable>
 

Answers (1)