Error type mData
Error type mData
Hello i have a problem with Datatables i try to link my code but is it impossible
i have this error
Uncaught TypeError: Cannot read property 'mData' of undefined
at HTMLTableCellElement.<anonymous> (jquery.dataTables.min.js:89)
at Function.each (jquery.js:354)
at jQuery.fn.init.each (jquery.js:189)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:89)
at Function.each (jquery.js:354)
at jQuery.fn.init.each (jquery.js:189)
at jQuery.fn.init.m [as dataTable] (jquery.dataTables.min.js:82)
at jQuery.fn.init.h.fn.DataTable (jquery.dataTables.min.js:164)
at HTMLDocument.<anonymous> (info_bdd:252)
at mightThrow (jquery.js:3534)
``
sorry is impossible to link my code i have error "Body is 15116 characters too long."
i don't understand why function a datatable forum... my code is very long
Replies
my js first part
my part two
my html first part
my html part two
```
<tbody>
</div>
</div>
My guess is your HTML table does not match your Datatables config. Hard to tell without seeing snippets of your code. I would start by making sure you meet the requirements listed here:
https://datatables.net/manual/installation#Requirements
Kevin
im in model mvc
my controllers part one
```
public function info_bdd()
{
my controllers part two
```
}
if(!empty($db))
{
foreach ($db as $row)
{
I didn't count the number of columns you have but it looks like the problem is mismatched table -tag thead
tags and
-option columns.data` definitions.In your table you have this:
However in your Datatables you have this:
You might need to move your
columnDefs
config for column 0 into thecolumns.data
option:Kevin
i try this but i have this error
Uncaught TypeError: Cannot read property 'style' of undefined
at Ea (jquery.dataTables.min.js:62)
at ga (jquery.dataTables.min.js:48)
at e (jquery.dataTables.min.js:92)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:92)
at Function.each (jquery.js:354)
at jQuery.fn.init.each (jquery.js:189)
at jQuery.fn.init.m [as dataTable] (jquery.dataTables.min.js:82)
at jQuery.fn.init.h.fn.DataTable (jquery.dataTables.min.js:164)
at HTMLDocument.<anonymous> (info_bdd:252)
at mightThrow (jquery.js:3534)
thanks for you help
You may need to add one or both of the following to column 0:
Kevin
Your solution its ok but i have even problem
Uncaught TypeError: Cannot read property 'style' of undefined
at Ea (jquery.dataTables.min.js:62)
at ga (jquery.dataTables.min.js:48)
at e (jquery.dataTables.min.js:92)
at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:92)
at Function.each (jquery.js:354)
at jQuery.fn.init.each (jquery.js:189)
at jQuery.fn.init.m [as dataTable] (jquery.dataTables.min.js:82)
at jQuery.fn.init.h.fn.DataTable (jquery.dataTables.min.js:164)
at HTMLDocument.<anonymous> (info_bdd:252)
at mightThrow (jquery.js:3534)
but your solution corrected one problem really thanks for you time for my problem Kevin
The only other thing that stands out is your
ajax
option config:If you want the
"type": "POST",
to be applied then you need to place the URL andtype
option inside an object for theajax
option. Take a look at the 4th example here:https://datatables.net/reference/option/ajax#Examples
I believe this is normally due to mismatches between the HTML table and Datatables config. Make sure all your
columns.data
objects match with what is returned in your server script. Also I would use the browser's developer tools to verify the ajax response is what you expect.Kevin