Unable to set property '_DT_CellIndex' of undefined or null reference

Unable to set property '_DT_CellIndex' of undefined or null reference

D.B.talavarD.B.talavar Posts: 6Questions: 2Answers: 0

I am getting the error "Unable to set property '_DT_CellIndex' of undefined or null reference" while collapsing the nested datatable,
i checked that the columns in the header and the tbody are equal.

please help

Answers

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    Happy to take a look at a test page showing the issue and help debug it if you post a link to the page or a JSFiddle of it.

    Allan

  • D.B.talavarD.B.talavar Posts: 6Questions: 2Answers: 0

    you can take a look at this link: http://jsfiddle.net/6j6oogsa/6/
    I have added the below css change to remove Search and pagination for internal DataTables

    .dataTables_filter, .dataTables_info, .dataTables_paginate, .dataTables_length {
    display: none;
    }

    Now, this is how you can reproduce the issue:
    1. Expand Data1a row
    2. Expand Data2a row
    3. now expand 'aaa' under Data1a
    4. now expand 'aaa' under Data2a
    5. Go back to collapse 'aaa' under Data1a - Duplicate Datatable gets added

    I am attaching my aspx file and the js file. I am loading the data from the database through ajax calls.. Also attaching the Error and UI screenshot.

  • D.B.talavarD.B.talavar Posts: 6Questions: 2Answers: 0

    I know there is so much to work is there for you by going through this, please help us with this.

  • JchapJchap Posts: 2Questions: 0Answers: 0
    edited June 2017

    Ran into same issue here.. tremendously appreciate your help, Allan!

  • allanallan Posts: 63,893Questions: 1Answers: 10,531 Site admin

    I think its related to the fact that the HTML is actually invalid since there are multiple elements with the same id. For example when you complete steps 1 and 2, there are two tables on the page which have the same id: tableSecondLevel. That isn't valid and its going to mess up any selectors.

    I haven't had a chance yet to go through all of the code and try to make it work, but that is where I would suggest you start. Either drop the ids entirely or use a unique id for each one.

    Allan

  • D.B.talavarD.B.talavar Posts: 6Questions: 2Answers: 0

    I noticed now, the columns in the <tbody> of parent Table are created with a colspan (in my case it is 18), i have not mentioned the colspan anywhere in the table, This might be the issue.

    i see some 'rowspan' and 'colspan' in jquery.dataTables.min.js. Could not figure out where this is being added to my datatable.

    please take a look at SLAJs.txt file(here i have created the table with id and nested table).
    The reference jquery files i used for this is - jquery-2.2.4.min.js and jquery.dataTables.min.js

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Either drop the ids entirely or use a unique id for each one.

    Did you deal with that?

  • JchapJchap Posts: 2Questions: 0Answers: 0

    Hey guys, I was working with D.B on this.

    Allan, that was indeed the problem: tableSecondLevel ID being used for multiple tables. We made the ID unique to each table and this solved the problem. Thank you so much for your help on this!! :)

  • D.B.talavarD.B.talavar Posts: 6Questions: 2Answers: 0

    Thank you so much Allan!! :) .

This discussion has been closed.