Using bVisible reports error nTh.parentNode is null
Using bVisible reports error nTh.parentNode is null
Hi,
I'm using DataTables V1.6.2 with server-side processing and trying to hide a column but get the error:
Firefox 3.5.9: Error: nTh.parentNode is null Source File: http://blah/js/jquery.dataTables.min.js Line: 240
Chrome 5.0.?: Uncaught TypeError: Cannot call method 'removeChild' of null Line 240
Also tried the beta but the same error. I'm not a expert in JS/jQuery so it may be a user mistake.
Below is my js code:
[code]
jQuery(document).ready(function($) {
$("#test").dataTable({
"bProcessing": true,
"bServerSide": true,
"bFilter": false,
"iDisplayLength": 12,
"bLengthChange": false,
"bAutoWidth" : false,
"aoColumns": [
{ "sClass": "rank", "sWidth": "24%" },
{ "sClass": "user", "sWidth": "50%" },
{ "sClass": "points", "sWidth": "24%" },
{ "bVisible": false }
],
"oLanguage": {
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries"
},"fnRowCallback": function (nRow, aData, iDisplayIndex) {
if (aData[3] == 1) {
nRow.className = "logged-in-user";
}
return nRow;
},
"sAjaxSource": test.php
});
});
[/code]
Changing bVisible to { "sClass": "hidden", "sWidth": "1%" } works as a temporary fix, but the hidden column are user Id's which I would prefer to not show in the page.
Apart from this minor glitch everything works brilliantly and I'm really impressed. Thanks.
If you need any more info, let me know.
Regards,
Ian.
I'm using DataTables V1.6.2 with server-side processing and trying to hide a column but get the error:
Firefox 3.5.9: Error: nTh.parentNode is null Source File: http://blah/js/jquery.dataTables.min.js Line: 240
Chrome 5.0.?: Uncaught TypeError: Cannot call method 'removeChild' of null Line 240
Also tried the beta but the same error. I'm not a expert in JS/jQuery so it may be a user mistake.
Below is my js code:
[code]
jQuery(document).ready(function($) {
$("#test").dataTable({
"bProcessing": true,
"bServerSide": true,
"bFilter": false,
"iDisplayLength": 12,
"bLengthChange": false,
"bAutoWidth" : false,
"aoColumns": [
{ "sClass": "rank", "sWidth": "24%" },
{ "sClass": "user", "sWidth": "50%" },
{ "sClass": "points", "sWidth": "24%" },
{ "bVisible": false }
],
"oLanguage": {
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries"
},"fnRowCallback": function (nRow, aData, iDisplayIndex) {
if (aData[3] == 1) {
nRow.className = "logged-in-user";
}
return nRow;
},
"sAjaxSource": test.php
});
});
[/code]
Changing bVisible to { "sClass": "hidden", "sWidth": "1%" } works as a temporary fix, but the hidden column are user Id's which I would prefer to not show in the page.
Apart from this minor glitch everything works brilliantly and I'm really impressed. Thanks.
If you need any more info, let me know.
Regards,
Ian.
This discussion has been closed.
Replies
What does your HTML in the thead element look like? I'm going to guess that there aren't 4 TH elements in the THEAD>TR as that would cause this error. Is that the case? If not, could you perhaps post your HTML please?
Thanks!
Allan
Thanks for the swift response.
Yes, there are only 3 elements.
Just added a dummy and it works with bVisible and the dummy TH is not rendered.
I assume adding the dummy header column is the correct way.
Thanks.
Regards,
Allan