【问题标题】:I didnt get the datatable format in my page我没有在我的页面中获得数据表格式
【发布时间】:2016-07-25 07:20:07
【问题描述】:

我为一页添加了数据表,但它不应该得到数据表格式

<script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.12/js/dataTables.bootstrap.min.js"></script>
<table class="example3" id="example1">
    <tr>
        <td></td>
        <td></td>
    </tr>
</table>

<script>
  $(document).ready(function() {
    $('.example3').DataTable();
    alert('1234567890');

  } );
</script>

我遇到了这样的错误,我检查了 class 和 id class 它们都来自数据库。如果我删除数据,我也不会得到值。

TypeError: c 未定义

    ...ldren("th, td").each(function(a,b){var c=o.aoColumns[a];if(c.mData===a){var d=s(...

请让我知道错误在哪里,因为其他项目中使用的代码相同。

【问题讨论】:

  • 我们需要有关您的代码的更多信息,因为您的代码似乎工作得很好:jsfiddle.net/zdrpd2fs
  • 尝试添加带有行标题的 标记

标签: php jquery codeigniter datatables


【解决方案1】:

您的表格必须具有正确的结构,请参阅Installation - HTML

<table class="example3" id="example1">
   <thead>
   <tr>
      <th>Heading 1</th>
      <th>Heading 2</th>
   </tr>
   </thead>
</table>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-23
    • 2016-01-26
    • 1970-01-01
    相关资源
    最近更新 更多