Uncaught TypeError: Cannot read property 'style' of undefined
Uncaught TypeError: Cannot read property 'style' of undefined
islamelshobokshy
Posts: 99Questions: 20Answers: 1
I get this error above when datatables try to load :
Uncaught TypeError: Cannot read property 'style' of undefined
at Ha (jquery.dataTables.min.js:62)
at ha (jquery.dataTables.min.js:48)
at e (jquery.dataTables.min.js:93)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:93)
at Function.each (jquery-1.12.0.min.js:2)
at n.fn.init.each (jquery-1.12.0.min.js:2)
at n.fn.init.m [as dataTable] (jquery.dataTables.min.js:82)
at n.fn.init.h.fn.DataTable (jquery.dataTables.min.js:167)
at Object.success (purchase_report.php?filtre_saison[]=17&filtre_references=&filtre_haut_bas=&filtre_type_achat=2&filtre_date_debut=&filtre_date_fin=&selecteur_marques=1&selecteur_collections=1&selecteur_quantite=1&selecteur_taux_de_marge=1:7864)
at i (jquery-1.12.0.min.js:2)
I read that it's because the number of th in header and footer are not the same, well, they technically are. In head there's 4, hard html coded, and in footer there are 2 hard coded and 2 generated using javascript inside a jquery $.ajax success :
for(c=0; c<data.data[0].size_selecteurs; c++) {
$("#tableID>tfoot>tr").append("<th></th>");
}
Why doesn't this work and I still get the error? Am I missing something?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm sorry, the question is irrelevant, when I dug deeper I did NOT have the same amount of th in the body section. Silly me.
Now I do, and I still get the same error tho. My ajax file returns only 4 for each data, but that doesn't seem to fix my issue :
Hi @islamelshobokshy ,
We'll need all the code, with the JSON, to make any sense of this one - and preferably with a running example that we can see.
Cheers,
Colin