Add class to row based on if condition (if == null)
Add class to row based on if condition (if == null)
peter-werk
Posts: 8Questions: 4Answers: 0
Hello I have column with social icons and if data == null for the item I would like to add class disbaled to this item. The problem is that I have 3 icons and data can be avalible for on two or all three items
data: null,
searchable: false,
render: function ( data, type, row ) {return '<div class="d-flex justify-content-between"><a href="'+row.Team_tw+'" class="fa fa-brands fa-twitter'+{if (row.Team_tw == null) (return "disabled")}+'"></a><a href="'+row.Team_yt+'" class="fa fa-brands fa-youtube"></a> <a href="'+row.Team_telegram+'" class="fa fa-brands fa-telegram"></a></div>'}},
This question has an accepted answers - jump to answer
Answers
You can use rowCallback. This has an example, too:
https://datatables.net/reference/option/rowCallback
And an example from my own coding:
Thank you your answer give me some hints here is the final solution for community
And setup of the column is like this