Unexpected number of TD elements Error

Unexpected number of TD elements Error

bryceray1121bryceray1121 Posts: 65Questions: 0Answers: 0
edited July 2011 in General
I'm must be blind because I can't see anything wrong with my code, but i'm getting the error below. Any ideas what might be causing this?

[quote]
DataTables warning (table id = 'members_table'): Unexpected number of TD elements. Expected 2 and got 1. DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.
[/quote]

HTML:
[code]




Name
Date Created





Loading data from server





Name
Date Created



[/code]

JSON Data
[code]
{
"sEcho":3,
"iTotalRecords":15,
"iTotalDisplayRecords":15,
"aaData":[
["family","2011-07-17"],
["friends","2011-07-03"],
["test","2011-07-20"],
["test10","2011-07-20"],
["test11","2011-07-20"],
["test12","2011-07-20"],
["test2","2011-07-20"],
["test3","2011-07-20"],
["test4","2011-07-20"],
["test5","2011-07-20"],
["test6","2011-07-20"],
["test7","2011-07-20"],
["test8","2011-07-20"],
["test9","2011-07-20"],
["work","2011-07-11"]
]
}
[/code]

Datatables JS
[code]
$(document).ready(function() {
if($("#groups_table").length != 0){
$('#groups_table').dataTable( {
"bJQueryUI": true,
"bProcessing": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"sAjaxSource": "processing/groups.php",
"fnServerData": fnDataTablesPipeline
} );
}else if($("#members_table").length != 0){
var group_id = $.getUrlVar("grp");
if(group_id){
$("#members_table").dataTable( {
"bJQueryUI": true,
"bProcessing": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"sAjaxSource": "processing/members.php?group_id=".group_id,
"fnServerData": fnDataTablesPipeline
} );
}else{
window.location.href = "Groups.php";
}
}else{

}
} );
[/code]

Thanks for the help. I hope my error is not too obvious because I've looked over this code many times without spotting an error.

Replies

  • pmccannpmccann Posts: 9Questions: 0Answers: 0
    Sorry for the obviousness of this, and certainly I'm not sure if this is causing DataTables grief, but shouldn't that be "colspan=2" in the table body while loading? Maybe the error's propagating somehow as a result of this simple problem?
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    I'm surprised by that error since you've got "bServerSide": true - however could you try updating to DataTables 1.8 (the nightly would be best) and see how that goes for you?

    Allan
  • bryceray1121bryceray1121 Posts: 65Questions: 0Answers: 0
    I adjusted the colspan to 2 (obvious mistakes are sometimes the toughest to find so thanks) and updated to the nightly build of datatables. I am still getting the same error though. :(
  • bryceray1121bryceray1121 Posts: 65Questions: 0Answers: 0
    This error magically went away, so not sure what i did to fix it. I am however having a problem with the same code in chrome. For some reason the ajax load will just not work in chrome. This is the code I'm using:

    [code]
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">



    Groups











    Name
    Date Created




    Loading data from server




    Name
    Date Created







    $(document).ready(function() {
    if($("#groups_table").length != 0){
    $('#groups_table').dataTable( {
    "bJQueryUI": true,
    "bProcessing": true,
    "sPaginationType": "full_numbers",
    "bServerSide": true,
    "sAjaxSource": "json.php",
    "fnServerData": fnDataTablesPipeline
    } );
    }else if($("#members_table").length != 0){
    var group_id = $.getUrlVar("grp");
    if(group_id){
    $("#members_table").dataTable( {
    "bJQueryUI": true,
    "bProcessing": true,
    "sPaginationType": "full_numbers",
    "bServerSide": true,
    "sAjaxSource": "processing/members.php?group_id=".group_id,
    "fnServerData": fnDataTablesPipeline
    } );
    }else{
    window.location.href = "Groups.php";
    }
    }else{

    }
    } );


    var oCache = {
    iCacheLower: -1
    };

    function fnSetKey( aoData, sKey, mValue )
    {
    for ( var i=0, iLen=aoData.length ; i
This discussion has been closed.