Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery DataTables console error - Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined #1

Open
alulsh opened this issue Jan 31, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@alulsh
Copy link
Owner

alulsh commented Jan 31, 2021

When you initially load https://www.alexandraulsh.com/family-tree-map/ you see the following error in the browser console:

Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined
    at rt (jquery.dataTables.js:3140)
    at X (jquery.dataTables.js:2453)
    at HTMLTableRowElement.<anonymous> (jquery.dataTables.js:2481)
    at jquery.js:208
    at Function.map (jquery.js:463)
    at w.fn.init.map (jquery.js:207)
    at J (jquery.dataTables.js:2479)
    at N (jquery.dataTables.js:1281)
    at HTMLTableElement.<anonymous> (jquery.dataTables.js:1306)
    at Function.each (jquery.js:381)

The error has no effect on application functionality and you can load a GEDCOM file successfully.

Per https://stackoverflow.com/a/35928281, this error is likely happening because we initialize a blank empty table with only a thead with six table headers (th) and no td elements.

Adding a tbody with a table row and 6 tds does resolve the error:

<tbody>
  <tr>
    <td>Text</td>
    <td>Text</td>
    <td>Text</td>
    <td>Text</td>
    <td>Text</td>
    <td>Text</td>
  </tr>
</tbody>

Unfortunately, with the new table row, the DataTables search helper initializes twice, despite only intending to initialize DataTables once:

Screen Shot 2021-01-31 at 1 54 55 PM

If you load a GEDCOM file, one table stays with 1 result. The other table processes the GEDCOM file, so it is likely that DataTables may be initialized twice.

Screen Shot 2021-01-31 at 1 56 37 PM

@alulsh alulsh added the bug Something isn't working label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant