Javascript 数据表isn';我没有在我的桌子上工作

Javascript 数据表isn';我没有在我的桌子上工作,javascript,php,datatable,Javascript,Php,Datatable,我的一个表有问题,它不显示为DataTable,而另一个显示为DataTable。。。 我看不出我在哪里失败了,所以它是这样的: 工作数据表(看起来像一个数据表) 谢谢你的时间 您的表中总共有3个“”列和4个“”列,这就是它不工作的原因。检查浏览器的控制台。通常会出现一些Javascript错误,使Javascript无法运行,并且无法执行DataTable代码。由于标记的数量小于标记的数量,datatables会进行非常严格的检查。因此,添加一个作为操作,这不是向我们显示错误的最佳方式。最好把

我的一个表有问题,它不显示为DataTable,而另一个显示为DataTable。。。 我看不出我在哪里失败了,所以它是这样的:

工作数据表(看起来像一个数据表)
谢谢你的时间

您的表中总共有3个“
”列和4个“
”列,这就是它不工作的原因。

检查浏览器的控制台。通常会出现一些Javascript错误,使Javascript无法运行,并且无法执行DataTable代码。由于标记的数量小于标记的数量,datatables会进行非常严格的检查。因此,添加一个作为操作,这不是向我们显示错误的最佳方式。最好把它加到问题上。但是,我首先要确保标题中的列数与行中的列数相同,就像Sanjit Bhardwai建议的那样。@SanjitBhardwaj就是这样!!谢谢但是我需要添加colspan,所以视觉上只有1列占据2列。。。那我该怎么办呢?总是先调查一下自己,然后再问。你会找到这样的答案:我同意这是个问题,但你测试过这个吗?这是一个相当大胆的声明。
<table id="tabla-diccionarios" class="display table table-bordered table- 
striped table-hover tabla-usuarios" width="75%">
                            <thead>
                                <tr>
                                    <!-- <th>ID</th>
                                    <th>Tipo</th> -->
                                    <th>Nombre</th>
                                    <!-- <th data-orderable="false">Ver 
elementos</th> -->
                                </tr>
                            </thead>
                            <tbody> 
                                <?php foreach ($diccionarios as 
$diccionarios): ?>
                                    <tr>
                                        <!-- <td><?php echo 
$diccionarios['DICC_Id']; ?></td>
                                        <td><?php echo 
$diccionarios['DICC_Tipo'];?></td> -->
                                        <td><a href="<?php echo 
base_url('diccionarios/elementos_diccionario/'.$diccionarios['DICC_Id']); ? 
>"><?php echo $diccionarios['DICC_Nombre'];?></td>
                                        <!-- <td>
                                            <a href="<?php echo 
 base_url('diccionarios/elementos_diccionario/'.$diccionarios['DICC_Id']); ? 
 >">
 <i class="material- icons">info_outline</i></a>
                                        </td> -->
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
<table id="tabla-elementos" class=" display table table-bordered table- 
striped table-hover tabla-usuarios">
                            <thead>
                                <tr>
                                    <th>Key</th>
                                    <th>Display</th>
                                    <th colspan="2">Acciones</th>
                                </tr>
                            </thead>
                            <tbody> 
                                <?php foreach ($elementos as $elementos): ?>
                                    <tr data-id='<?php echo 
$elementos['ELDI_Id']; ?>'>
                                        <td><?php echo 
$elementos['ELDI_Key'];?></td>
                                        <td><?php echo 
$elementos['ELDI_Display'];?></td>
                                        <td>
                                            <span class="btn btn-default 
editar_elemento" id='<?php echo $elementos['ELDI_Id']; ?>' value="<?php echo 
$elementos['ELDI_Id'];?>">
                                                <a href="<?php echo base_url('diccionarios/elemento_diccionario').'/'.$elementos['ELDI_Id'];?>" title="Editar">
                                                    <i class="material-icons">edit</i>
                                                </a>
                                            </span>
                                        </td>
                                        <td>
                                        <span class="btn btn-default borrar_elemento" id='<?php echo $elementos['ELDI_Id']; ?>' value="<?php echo $elementos['ELDI_Id'];?>">
                                                <i class="material-icons">delete_outline</i>    
                                            </span>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
$('#tabla-diccionarios').DataTable( {
    "pagingType": "simple_numbers",
    "lengthMenu": [[-1, 10, 25, 50], ["Todos", 10, 25, 50]],
    "language": {
        "lengthMenu": "Mostrar registros _MENU_ ",
        "zeroRecords": "No se encontraron resultados.",
        "info": "Mostrando registros del _START_ al _END_ de un total de 
_TOTAL_ registros.",
        "infoEmpty": "No hay registros disponibles",
        "infoFiltered": "(filtrado de un total de _MAX_ registros)",
        "paginate": {
            "previous": "Anterior",
            "next": "Siguiente",
        },
        "search": "Buscar: ",
    }
});