table.responsive.hasHidden() gives "Cannot read property 'hasHidden' of undefined"
table.responsive.hasHidden() gives "Cannot read property 'hasHidden' of undefined"
darrenm
Posts: 29Questions: 11Answers: 0
I'm trying to perform some functions on page load if responsive has hidden any columns. I think I can use hasHidden() for this, but when I try to check it in my code I get the "Cannot read property 'hasHidden' of undefined" error.
All the responsive functions are working fine.
I am trying to check hasHidden in the initComplete function of the DataTable call.
My code:
$("#sale").DataTable({
pageLength: 25,
responsive: true,
stateSave: true,
// etc...
initComplete: function () {
if ($("#sale").responsive.hasHidden()) {
$("#filterpanel").show();
}
else {
$("#filterpanel").hide();
}
}
});
Is this a timing issue or am I doing something else wrong?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @darrenm ,
You need to get into the API - so either
$("#sale").DataTable().responsive.hasHidden()
orthis.api().responsive.hasHidden()
- see example here,Cheers,
Colin
Damn I thought I tried that, but obviously not! Perfect, thank you.