I am trying to hide a Datable column when a condition is met. Here is what I have discovered and I am a bit lost.
Aproach 1 - this proves the theory I was testing but the column is always hidden (as expected)
var userTable = DataTable(this.$('#someTable'),{
"bLengthChange" : true,
"bInfo" : true,
"aoColumns" : [
{ "mDataProp" : function(d){
return ("Test" || "N/A";
}, "bVisible" : false, "bSortable" : true, sName : "Column1"
},
{ "mDataProp" : function(d){
return ("Test" || "N/A";
}, "bVisible" : true, "bSortable" : true, sName : "Column2"
},
]
}
Approach 2 : Using ternary operator - Column is always visible. How can I fix this ?
var userTable = DataTable(this.$('#someTable'),{
"bLengthChange" : true,
"bInfo" : true,
"aoColumns" : [
{ "mDataProp" : function(d){
return ("Test" || "N/A";
}, "bVisible" : function(d){return true ? 1 : false}, "bSortable" : true, sName : "Column1"
},
{ "mDataProp" : function(d){
return ("Test" || "N/A";
}, "bVisible" : true, "bSortable" : true, sName : "Column2"
},
I am at a loss of what am I doing wrong (there has to be something really simple that I am missing).
Thank you