Uncaught TypeError: Cannot read property 'enable' of undefined
Uncaught TypeError: Cannot read property 'enable' of undefined
prats
Posts: 45Questions: 21Answers: 0
Hi,I have check box,on click of that chkbx my header should be fixed and on uncheck should be movable.I have used that enable/disable fixedheader option of data table plugin,but it's getting error as can not read property.
$(document).ready(function() {
var table= $('#example').dataTable( {
fixedHeader: {
header: true,
}
});
$('#chk').on( 'click', function (){
if($('#chk').prop('checked')){
table.fixedHeader.enable();
alert('Enabled Fixed Header');
}
else if(!$('#chk').prop('checked')){
table.fixedHeader.disable();
alert('Disabled Fixed Header');
}
});
});
Is my code correct?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
Thanks,
Allan
Hi allan,Its working fine..