anTr[0] is undefined using 1.7.5

anTr[0] is undefined using 1.7.5

datazendatazen Posts: 4Questions: 0Answers: 0
edited February 2011 in General
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?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi datazen,

    Can you possibly post your HTML for the table please?

    Thanks!
    Allan
  • datazendatazen Posts: 4Questions: 0Answers: 0
    Hey Allan, thanks for getting back to me. Here is the code. It's actually part of the page which is a js function. My codebase uses jQuery and jQueryUI. It's invoked by the onclick event handler - ie. onclick="doAction('check');

    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
  • flashfogflashfog Posts: 17Questions: 0Answers: 0
    I'm getting the same issue, I haven't been able to upgrade because of it.
  • datazendatazen Posts: 4Questions: 0Answers: 0
    Alan, any update here?
  • flashfogflashfog Posts: 17Questions: 0Answers: 0
    Just figured it out I think... added to my which was empty because I have the search columns in the header.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi 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
This discussion has been closed.