how to add conditions on column:data?
how to add conditions on column:data?

if the are conditions true, i want to show this column, where should i check the conditions
"columnDefs": [
{
"targets": [ 0 ],
"data":"id",
"orderable": true,
'render': function (data, type, row) {
// return '<a href="#" id="' + row.id +'" data-booking='+JSON.stringify(row)+' class="show-booking">'+row.booking_reference+'</a>'
},
},
]
or
columns: [
{ data: "booking_reference", 'render': function (data, type, row) {
return '<a href="#" id="' + row.id +'" data-booking='+JSON.stringify(row)+' class="show-booking">'+row.booking_reference+'</a>'
},
},
]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @madusanka ,
If you're rendering already, you could check for the data condition, flag the column to be hidden, then do it in
initComplete
withcolumn().visible()
. Otherwise, still hide the column ininitComplete
, but check the column data there withcolumn().data()
.Cheers,
Colin
i used column().visible() and i gave me the what i wanted. Thanks @colin