Conditional columns target
Conditional columns target

Hello everyone,
i would like to target specific columns using a conditional statement.
How to do this in my columndefs?
I would like to target [0,1,2,3,4,5] columns or target [1,2,3,4,5] depending on an if then statement...
I tried in many ways without results.
Could someone gives me an hint?
Thank you very much
This discussion has been closed.
Answers
One option may be to use a class name as described in the
columnDefs.targets
docs.Another option is to set the array in a variable outside Datatables then use that for the
targets
, for example:http://live.datatables.net/judobuwa/1/edit
Kevin
Thank you for the answer. I was thinking the same. I tried and it worked fine.
I Would like to know if is possibile to do directly something similar inside trhe columndefs.
Thank you
You can use something like this example:
http://live.datatables.net/judobuwa/3/edit
This uses a Conditional Operator to select between two options. Just toggle the
col1
variable between true / false to see the result.Kevin