I am not be able to resolve following Datatables error:
SCRIPT5007: Unable to set property '_DT_CellIndex' of undefined or null reference
I tried to look all over the internet and found this to be the best solution. But I am still not able to resolve this issue. Am I missing something here? I am a newbie in JavaScript.
Basically this issue came out because of miss matching count of th to td. be sure for number of th matches to td. hope this will help you.
We had the same error! What fixed it for us was changing the target
in the dataTable
initialization based on the number of columns starting from 0.
In our table we had 4 columns so targets: [3]
$.extend($.fn.dataTable.defaults,{
columnDefs: [{
targets: [3]
}]
});
In my case, using colspan in a row, the number of cells didn't match the table headers so this error shows. you can add these hidden cells to get rid of that error.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With