Datatable: disableSelection property for checkboxes
How can I use the template directive to disable certain checkboxes?
For example, if the color field is equal to green, disable the checkbox or simply replace it with a "N/A".
+1 for that Feature.
I need to disable the checkboxes in the table as well. My current solution is to have to coulmns which are hidden or shown with an *ngIf.
<p-column selectionMode="multiple" *ngIf="isDisabled()"></p-column>
<p-column *ngIf="!isDisabled()">
<template let-row="rowData" pTemplate type="body">
<p-checkbox name="displayDisabledCheckboxes" [(ngModel)]="_ngModel_" value="_value_" disabled="true" binary="true"></p-checkbox>
</template>
</p-column>
@severinkehding How did you get access to the individual row data in *ngIf="isDisabled()" for your work around?
@kotojo perhaps i do not understand you question correctly but i'll access the row data with the [(ngModel)]="ngModel" binding as usual.
The checkbox is either editable or disable. If the user is eligible to edit the checkbox value the binding will obviously change the value. if he is not eligible the binding will show the given value. i simply hide or show the right html piece depending on the isDisabled() result.
I have implemented disabling checkbox with condition like it
disable=true
Here is the repo to my implementation . https://github.com/sryara/primeng-webpack-datatable-checkbox-disable
Probably this might not be a ideal solution but works for basic requirement of conditional checkbox disable.
+1 for this feature
p-dataTable is deprecated and will be removed in favor of the new p-table (aka TurboTable) of 5.1.0 so closing the issue. Please try the new p-table once 5.1.0 is released.