Cannot read property 'cell' of undefined

Cannot read property 'cell' of undefined

joatmanjoatman Posts: 11Questions: 0Answers: 0
edited September 2011 in General
Hello Allan,
We seem to be getting this error when DataTables is trying to render the header in _fnDrawHead in this section:
[code]
while ( typeof aoLocal[i+iRowspan] != 'undefined' &&
aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )
{
aApplied[i+iRowspan][j] = 1;
iRowspan++;
}
[/code]
The aoLocal[i+iRowspan][j] object is coming up as undefined.

Any high level ideas on what might be going wrong? if not, i'll try to create some sample code to recreate the issue.
Thanks,
Nilesh

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    At a rough guess I'd say that the rowspans, colspans, cells and rows don't add up in your header. If you could show us you THEAD HTML that would be useful.

    Allan
  • joatmanjoatman Posts: 11Questions: 0Answers: 0
    The THEAD is pretty ugly, but here it is - most of this works for most clients, but it's causing an issue in this case. Only the very first column header "Departs" shows up, and then it gets the error:
    [code]




    Departs


    Arrives

    Flight Information
    Stops














    Economy Smash










    Economy Smash >
    As Good As it Gets!







    Want More?
    Upgrade to Ecomomy Super Saver & Earn Sunmiles Points








    Economy Super Saver










    Economy Saver >
    Book & Save!







    Want More?
    Upgrade to Ecomomy Value & Pre-Reserve your seat Now








    Economy Saver










    Economy Value >
    Affordable Value!







    Want More?
    Upgrade to Ecomomy >> Free Rebooking, Refund, Pre-Reservation
    of Seat + More!








    Economy Value










    Economy >
    Privileged Economy!







    Want More?
    Upgrade to Business >> Spacious Seats, Generous Carry on
    & Baggage allowances, Priority Check-in + more








    Economy










    Business >
    Affordable luxury! > Spacious Seats, Generous Carry on
    & Baggage allowances, Priority Check-in + more











    Business Saver










    Business >
    Privileged luxury! > Spacious Seats, Generous Carry on
    & Baggage allowances, Priority Check-in + more











    Business






    [/code]
  • joatmanjoatman Posts: 11Questions: 0Answers: 0
    Allan,
    Okay, after a series of steps amounting to "reductio ad absurdum", i found out that the issue is caused because of a element stuck inside a element.
    Is there any way for you to confirm that that's a no-no?
    Thanks,
    Nilesh
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi Nilesh,

    Thanks for the extra information and debugging that - that most certainly should be possible to do and I'm considering that a bug in DataTables. Indeed, I've just committed a fix for it :-). You can get the very latest version (the 1.8.2.dev nightly) from the downloads page: http://datatables.net/download , with this fix in it.

    Let me know how you get on with it!

    Regards,
    Allan
  • joatmanjoatman Posts: 11Questions: 0Answers: 0
    wow, that was fast :) i'll let you know how it goes with the fix, but i'm sure it will work.
    Really appreciate the effort.
    Thanks,
    Nilesh
  • gdfuentesgdfuentes Posts: 2Questions: 0Answers: 0
    I've similar problem (aoLocal[i + iRowspan][j] is undefined) with the current table definition:




    FundId
    ManagerSpaceAccountId
    Fund Name
    As Of
    Performance
    Lastest Commentary
    Research Process - Last Action
    Interest
    Visibility



    1 Month
    3 Months
    6 Months
    1 Year
    2 Years
    3 Years
    Video
    PDF
    Action
    Date
    User




    My Js is:

    var wsGetData = '/ViewWatchList/GetList';

    $(document).ready(function () {
    $('#WatchListGridEx').dataTable({
    "bServerSide": true,
    "bProcessing": true,
    "sAjaxSource": wsGetData,
    "aoColumns": [
    { "mDataProp": "FundId" },
    { "mDataProp": "ManagerSpaceAccountId" },
    { "mDataProp": "FundName" },
    { "mDataProp": "AsOf" },
    { "mDataProp": "LastMonthPerformance" },
    { "mDataProp": "ThreeMonthsPerformance" },
    { "mDataProp": "SixMonthsPerformance" },
    { "mDataProp": "OneYearPerformance" },
    { "mDataProp": "TwoYearsPerformance" },
    { "mDataProp": "ThreeYearsPerformance" },
    { "mDataProp": "LastVideoCommentary" },
    { "mDataProp": "LatestPDF" },
    { "mDataProp": "LatestResearchProcessAction" },
    { "mDataProp": "LatestResearchProcessDate" },
    { "mDataProp": "LatestResearchProcessUser" },
    { "mDataProp": "Interest" },
    { "mDataProp": "Visibility" },
    ],
    "aoColumnDefs": [
    { "bSearchable": false, "bVisible": false, "aTargets": [0] },
    { "bVisible": false, "aTargets": [1] }
    ]
    });
    });

    I already download the 1.8.3.dev version and the problem persist.

    Can you help me please?
  • gdfuentesgdfuentes Posts: 2Questions: 0Answers: 0
    I fixed!

    change the following:
    [code]
    while (typeof aoLocal[i + iRowspan] != 'undefined' &&
    aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )
    {
    aApplied[i+iRowspan][j] = 1;
    iRowspan++;
    }
    [/code]

    for this:

    [code]
    while (typeof aoLocal[i + iRowspan] != 'undefined' &&
    typeof aoLocal[i + iRowspan][j] != 'undefined' &&
    aoLocal[i][j].cell == aoLocal[i+iRowspan][j].cell )
    {
    aApplied[i+iRowspan][j] = 1;
    iRowspan++;
    }
    [/code]
  • maqsoodmaqsood Posts: 0Questions: 0Answers: 0
    ,

    I am stuck with the same problem. I have following Table:

    [code]


    Ticker
    Short Name
    Sector
    Country
    1
    2




    0005.HK
    HSBC
    Banking
    Hong Kong
    Edit
    View More


    0386.HK
    SINOPEC
    Banking
    Hong Kong
    Edit
    View More


    [/code]

    I am using the following javascript to apply the DataTables for the table
    [code]$('#stockTable').dataTables();[/code]

    It shows only the first column name and rest of the headers are missing from the table. Any clue? I am use DataTables 1.9.1

    Regards,
    Maqsood Ahmed
This discussion has been closed.