【问题标题】:DataTables not working - Ignited Datatable Library数据表不工作 - 点燃的数据表库
【发布时间】:2014-07-10 17:47:39
【问题描述】:

我已使用 ignited datable 将其集成到 codeigniter 中,但出现以下错误:DataTables 警告:table id=example2 - Requested unknown parameter '0' for row 0。

$(document).ready(function() {
    $('#example2').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sServerMethod": "POST",
        "sAjaxSource": "<?php echo base_url()?>auth/datatable"
    } );            
} );

这是我的html

<table id="example2" class="table table-bordered table-striped">
                <thead>
                  <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Class</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                </tbody>
              </table>

这里是生成的json

{"draw":0,"recordsTotal":2,"recordsFiltered":2,"data":[{"email":"admin@admin.com","first_name":"Admin","last_name":"istrator"},{"email":"subhadeepgayen@gmail.com","first_name":"Subhadeep","last_name":"Gayen"}]}

似乎可以找到任何解决方案:(

【问题讨论】:

    标签: codeigniter datatable


    【解决方案1】:

    您好,您只需要指定列

    "columns": [
                    { "data": "id" },
                    { "data": "name" }
                  ]
    

    【讨论】:

      【解决方案2】:

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-29
        • 2015-03-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多