gyrocode / jquery-datatables-checkboxes

Checkboxes is an extension for the jQuery DataTables library that provides universal solution for working with checkboxes in a table.
https://www.gyrocode.com/projects/jquery-datatables-checkboxes/
MIT License
150 stars 61 forks source link

Disable Checkboxes Based On Column Data - Rowgroup #115

Closed Blimie closed 3 years ago

Blimie commented 4 years ago

Hi,

First and foremost - this plugin is great!

My question is how I can disable checkboxes based on column data. I'm using HTML-sourced data. I used this https://www.gyrocode.com/projects/jquery-datatables-checkboxes/examples/api/disable-checkboxes/ for a page where I didn't need rowgroup and it worked. But now I'm rowgrouping following your code here: https://www.gyrocode.com/projects/jquery-datatables-checkboxes/examples/integration/rowgroup/ and I can't seem to make some checkboxes disabled.

Thanks in advance!

mpryvkin commented 3 years ago

Sorry for the late reply. See this example for code and demonstration. I also added this example to the RowGroup page as well.

Blimie commented 3 years ago

Thanks Michael! Your example is exactly what I was looking for. Your jsfiddle works. Somehow when I copy your code it doesn't work for me. The checkboxes aren't rendered (so 'render' works) but the row isn't disabled (which means 'createdCell' doesn't work properly). Does it make a difference that my data is HTML-sourced?

mpryvkin commented 3 years ago

That is correct, for HTML-sourced data there is a different approach. See this example for HTML-sourced data.

Blimie commented 3 years ago

Thanks Michael, After tweaking the code a little that worked for me! For some odd reason data[2] didn't work. I had to do data.Position

Thanks again!