duanpu1111 2014-08-10 13:54
浏览 38
已采纳

将DataTable与Codeigniter一起使用时,它显示的是处理而不是显示数据

I'm trying to use DataTables with CodeIgniter.

Here is what I have done so Far.

1) Added the IgnitedDatatables Library to my library and called it to my datatables controller,

$this->load->library('Datatables.php');

2) View

<table id="ManageForms" class="table table-bordered table-condensed table-hover table-striped">
    <thead>
        <tr>
            <th>Form Name</th>
            <th>Browser</th>
            <th>Platform(s)</th>
            <th>Engine version</th>
            <th>CSS grade</th>
        </tr>
    </thead>
</table>

<script>
    $(document).ready(function() {
        $('#ManageForms').dataTable({
            "processing":true,
            "serverSide":true,
            "bProcessing":true,
            "sServerMethod": "POST",
            "sAjaxSource": "{{base_url()}}admin/configurations/listForms_DT/",
            "iDisplayLength": 10,
            "aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
            "aaSorting": [[0, 'asc']],
            "aoColumns": [
                { "bVisible": true, "bSearchable": true, "bSortable": true },
                { "bVisible": true, "bSearchable": true, "bSortable": true },
                { "bVisible": true, "bSearchable": true, "bSortable": true }
            ],
            "columns": [
                { "data": "FormName" }
            ],
            'fnServerData'   : function(sSource, aoData, fnCallback){
                $.ajax ({
                    'dataType': 'json',
                    'type'    : 'POST',
                    'url'     : sSource,
                    'data'    : aoData,
                    'success' : fnCallback
                }); //end of ajax
            }

        });
    });
</script>

3) Data in Json Return in this Form from the Path:

 {"data_DT":[{"FormID":"1","FormName":"Dashboard","FormPath":"#","FormCIPath":"admin\/dashboard\/System","IsMenuLink":"1","MenuID":"1","FormRoleID":"1","RoleID":"1","IsDeleteable":"1","IsEditable":"1","IsCreatable":"1"},{"FormID":"2","FormName":"Dashboard","FormPath":"#","FormCIPath":"admin\/dashboard\/Users","IsMenuLink":"1","MenuID":"2","FormRoleID":"2","RoleID":"1","IsDeleteable":"1","IsEditable":"1","IsCreatable":"1"},{"FormID":"3","FormName":"Residensials","FormPath":"#","FormCIPath":"#","IsMenuLink":"1","MenuID":"3","FormRoleID":"3","RoleID":"1","IsDeleteable":"1","IsEditable":"1","IsCreatable":"1"},{"FormID":"6","FormName":"Configuration","FormPath":"#","FormCIPath":"#","IsMenuLink":"1","MenuID":"6","FormRoleID":"4","RoleID":"1","IsDeleteable":"1","IsEditable":"1","IsCreatable":"1"},{"FormID":"7","FormName":"ManageForms","FormPath":"#","FormCIPath":"admin\/configurations\/ManageForms","IsMenuLink":"1","MenuID":"7","FormRoleID":"5","RoleID":"1","IsDeleteable":"1","IsEditable":"1","IsCreatable":"1"}]}

Now the Problem is that my DataTables instead of showing days, shows Processing??

I am not sure where did i go wrong, please if anyone can fix the issue or redirect me what did i do wrong?

  • 写回答

1条回答 默认 最新

  • dpbz14739 2014-08-11 20:04
    关注

    This message means, DataTable is unable to read properly your data.

    Using default settings, your ajax request must return data into aaData object.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常