0

I am working on datatables, I am getting the following error:

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

Does anybody encountered the same erro?

Thanks

2
  • 1
    I often get the error when you are trying to show more/less columns that exists in the actual HTML table. Care to share your code? Feb 23 '17 at 10:03
  • Yes this was exactly the issue..Thanks for responding
    – Dheeraj
    Feb 23 '17 at 16:44
2

This is because the count of element is different with count of element

For example:

<table>
    <tr>
        <th></th>
        <th></th>
        <th></th> <!-- 3 ths -->
    </tr>
    <tr>
        <td></td>
        <td></td>
        <td></td>
        <td></td> <!-- 4 tds -->
    </tr>
</table>

Either your table td is lower or table th is lower.

So the DataTable will make it as an error.

1
  • 1
    To restate Josua's point differently, this error is due to a mismatch of column count between the heading row and the data rows. Jul 29 '20 at 20:11
1

Try this:

<tr>
    <td colspan="4">details</td>
    <td style="display: none"></td>
    <td style="display: none"></td>
    <td style="display: none"></td>
</tr>

Add the required cells but hide them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.