Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to resolve Datatable SCRIPT5007: Unable to set property '_DT_CellIndex' of undefined or null reference

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.

like image 661
Frank D. Avatar asked Sep 26 '16 15:09

Frank D.


3 Answers

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.

like image 177
Ravi Mane Avatar answered Oct 20 '22 05:10

Ravi Mane


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]
  }]
});
like image 21
Rozh Ali Avatar answered Oct 20 '22 04:10

Rozh Ali


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

like image 7
Junaid Avatar answered Oct 20 '22 04:10

Junaid