anTr[0] is undefined using 1.7.5
anTr[0] is undefined using 1.7.5
With DataTables 1.6 this used to work fine with no errors. Upgraded to 1.7.5 and now get the following error:
anTr[0] is undefined
var nTfs = anTr[0].getElementsByTagName('th');
Note: This is a datatable within a jquery dialog window that sits on top of another datatable. The settings used for this table are:
oTable = $('#imagesCheckDataTable').dataTable({
"bProcessing": true,
"sAjaxSource": dataTableDataURL,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bDestroy": true,
"aoColumns": [{ "sWidth": "400px", "sClass": "dataColGroup" },
{ "sWidth": "400px", "sClass": "dataColTotal" }]
});
Again, no problems with 1.6 version.
Suggestions anyone?
anTr[0] is undefined
var nTfs = anTr[0].getElementsByTagName('th');
Note: This is a datatable within a jquery dialog window that sits on top of another datatable. The settings used for this table are:
oTable = $('#imagesCheckDataTable').dataTable({
"bProcessing": true,
"sAjaxSource": dataTableDataURL,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bDestroy": true,
"aoColumns": [{ "sWidth": "400px", "sClass": "dataColGroup" },
{ "sWidth": "400px", "sClass": "dataColTotal" }]
});
Again, no problems with 1.6 version.
Suggestions anyone?
This discussion has been closed.
Replies
Can you possibly post your HTML for the table please?
Thanks!
Allan
The code having the issue is the (id == 'check') section which is using datatables. This worked fine with 1.6
[code]
function doAction(id) {
if (id == 'check') {
// popup the dialog box
$("#checkContent").dialog({bgiframe: true, resizable: false, height:450, width:850, modal: true, overlay: { backgroundColor: '#000', opacity: 0.5 },
buttons: {
'<?php echo $zM_Language->get('button_close'); ?>': function() {
$(this).dialog('close');
}
}
});
var dataTableDataURL = '<?php echo zm_href_link_admin('rpc.php', $zM_Template->getModule() . '=' . $_GET[$zM_Template->getModule()] . '&action=checkImages'); ?>';
oTable = $('#imagesCheckDataTable').dataTable({
"bProcessing": true,
"sAjaxSource": dataTableDataURL,
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bDestroy": true,
"aoColumns": [{ "sWidth": "400px", "sClass": "dataColGroup" },
{ "sWidth": "400px", "sClass": "dataColTotal" }]
});
$("#checkContent").dialog('open');
}
}
.dataColGroup { text-align: left; }
.dataColTotal { text-align: center; }
<?php echo $zM_Language->get('table_heading_check_images'); ?>
<?php echo $zM_Language->get('table_heading_groups'); ?>
<?php echo $zM_Language->get('table_heading_totals'); ?>
[/code]
The JSON call works fine outside of the code and returns:
[code]
{"aaData":[["Originals<\/span>"," \/ 4<\/span>"],["Thumbnails<\/span>"," \/ 4<\/span>"],["Product Information Page<\/span>"," \/ 4<\/span>"],["Large<\/span>"," \/ 4<\/span>"],["Mini<\/span>"," \/ 4<\/span>"],["Popup<\/span>"," \/ 4<\/span>"]],"total":6,"rpcStatus":1}[/code]
Any ideas?
Thanks for your time.
--Scott
Sorry I completely missed your reply in all the other forum posts. The issue is that if DataTables sees a TFOOT element, it is expecting something to be in it. Since you don't have anything in it, just remove it and it should fix the issue. Alternatively you can add something in as flashfog has pointed out which should do the job as well.
Regards,
Allan