gpt4 book ai didi

php - jQuery 数据表 : Uncaught TypeError: Cannot read property 'mData' of undefined

转载 作者:搜寻专家 更新时间:2023-10-31 22:00:21 28 4
gpt4 key购买 nike

为什么会报错

Uncaught TypeError: Cannot read property 'mData' of undefined

我尊重 DataTables 要求(我还阅读了关于我的错误的其他主题,我尊重每个答案和解决方案)。请帮助我。

这是我的 PHP 代码:

<table class="table table-striped table-bordered table-hover" id="sample_1">
<thead>
<tr>
<th class="table-checkbox">
<input type="checkbox" class="group-checkable" data-set="#sample_1 .checkboxes"/>
</th>
<th>
Utilizator
</th>
<th>
Nume complet
</th>
<th>
Clasa
</th>
<th>
Functia
</th>
<th>
E-Mail
</th>
<th>
Ultima logare
</th>
</tr>
</thead>
<tbody>
<?
foreach($data["users"] as $student)
{
?>
<tr class="odd gradeX">
<td>
<input type="checkbox" class="checkboxes" value="1"/>
</td>
<td>
<? echo $student["username"]; ?>
</td>
<td>
<? echo " ".$student["last_name"]." ".$student["first_name"].""; ?>
</td>
<td>
<? echo getclass($student["class"]); ?>
</td>
<td>
<?
$functie = 0;
if($student["role"] == 1)
{
$functie = 1;
echo "Administrator site";
}
if($student["fctsc"])
{
$functie = 1;
echo "Director";
}
if($student["diriginte"])
{
$functie = 1;
echo "Diriginte";
}
if($student["profesor"])
{
$functie = 1;
echo "Profesor";
}
if($functie == 0)
echo "Elev";
?>
</td>
<td>
<a href="mailto:<? echo $student["email"]; ?>">
<? echo $student["email"]; ?>
</a>
</td>
<td class="center">
<? echo $student["lastlogin"]; ?>
</td>
</tr>
<?
}
?>
</tbody>
</table>

最佳答案

检查天气是否所有 php echo 实际上都在所有行上输出不为“NULL”的内容,因为 DataTables 会将任何只有 NULL 的单元格视为不存在的内容,这也可能导致该错误。
尝试避免将 php 直接输出到 html 表。

关于php - jQuery 数据表 : Uncaught TypeError: Cannot read property 'mData' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30121671/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com