Based on the API docs at DataTables site, I created the following javascript function to show only one specific table at a time:
function ShowColumn(columnNum) {
var table = $('#MemberStatisticGrid').dataTable();
$('#SelectedMetricList option').each(function (index) {
table.fnSettings().fnSetColumnVis(index, false);
});
table.fnSettings().fnSetColumnVis(columnNum, true);
}
However, this fails with the error Uncaught TypeError: Object #<1> has no method 'fnSetColumnVis'
I don’t get why I am getting this, as according to the API docs this is how you call it. Furthermore, when I view the available methods and properties on the fnSettings() via the chrome console, I don’t see a fnSetColumVis method.
What am I missing?
Have you tried just using
table.fnSetColumnVis? That works for me.