Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82027

How to disable a checkbox depending on cell value ?

$
0
0

Hello, I have dinamic tables and its rows always have in the first column a checkbox to select the entire row and its info.
My problem is that in a specific cell of every row, the data may be different, and depending on that, I have to " disable / prevent / forbid " the user to select that row.

I implemented the buttons: "Excel", "selectAll" and "selectNone"
Also implemented: "select-checkbox"

I use this: table.on('user-select', function (e, dt, type, cell, originalEvent)
and: e.preventDefault(); as a result when the value of cell is 'B'
also try: return false;
but is not working. The result is that as soon as the first 'B' option appears, the entire table disables clicking the checkbox of every row, no matter if it is 'A' or 'B', and clicking the 'Select All' button still works and checks everything, even the 'B' row, when it shouldn't.

So:
- if the cell data in a row is 'A', the user can use the checkbox by clicking the checkbox or click the 'Select All' button
- if it is 'B', the user can't use the checkbox, neither clicking on checkbox nor click on 'Select All' button

Hope you can help me, thanks in advance!!!


Viewing all articles
Browse latest Browse all 82027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>