CodeIgniter 2.2中的Datatable未显示服务器端MySQL数据

CodeIgniter 2.2中的Datatable未显示服务器端MySQL数据,codeigniter,datatable,Codeigniter,Datatable,我正在开发一个CodeIgniter应用程序,其中我希望将MySQL数据库中的数据显示到datatable中 控制器返回所需的数据,但不显示任何内容。相关代码段包括: <!--table--><div class="widget-body no-padding"> <table id="datatable_tabletools" class="table table-striped table-bordere

我正在开发一个CodeIgniter应用程序,其中我希望将MySQL数据库中的数据显示到datatable中

控制器返回所需的数据,但不显示任何内容。相关代码段包括:

<!--table--><div class="widget-body no-padding">

                            <table id="datatable_tabletools" class="table table-striped table-bordered table-hover" width="100%">
                                <thead>
                                    <tr>
                                        <th data-class="expand">StaffId</th>
                                        <th data-hide="phone">Narration</th>
                                        <th data-hide="phone">Account Number</th>
                                        <th data-hide="phone">Bank</th>
                                        <th data-hide="phone,tablet">Amount</th>
                                                                            </tr>
                                </thead>

                            </table>

                        </div>
                        <!-- end widget content -->

经过很长时间的延迟,代码终于运行了,这使我认为没有返回任何数据。延迟是由于结果集的大小,我使用的自定义查询没有强制分页,这是我下一步必须通过提出新问题来解决的问题。谢谢大家

可以关闭为“无法复制”。
<script type="text/javascript">

// DO NOT REMOVE : GLOBAL FUNCTIONS!

$(document).ready(function() {

    /* TABLETOOLS */
    $('#datatable_tabletools').dataTable({
        "bServerSide":true,
                "bProcessing": false,
                "sServerMethod": "POST",
                 // Load data for the table's content from an Ajax source
         "ajax":{'url':"<?php echo APP_URL.'/index.php/payments/seed';?>",
          'type':'POST',},
               "aoColumns": [

                        { "data": "reference" },
                        { "data": "narration" },
                        { "data": "accountnumber" },
                        { "data": "amount" },
                        { "data": "bank" }

                ],

            "sSwfPath": "<?php echo base_url("js/plugin/datatables/swf/copy_csv_xls_pdf.swf"); ?>"
        },
        "autoWidth" : true,
        "preDrawCallback" : function() {
            // Initialize the responsive datatables helper once.
            if (!responsiveHelper_datatable_tabletools) {
                responsiveHelper_datatable_tabletools = new ResponsiveDatatablesHelper($('#datatable_tabletools'), breakpointDefinition);
            }
        },
        "rowCallback" : function(nRow) {
            responsiveHelper_datatable_tabletools.createExpandIcon(nRow);
        },
        "drawCallback" : function(oSettings) {
            responsiveHelper_datatable_tabletools.respond();
        }
    });

    /* END TABLETOOLS */

})

</script>
public function seed()
    {
        $aColumns = array('reference','narration','accountnumber','amount','bank');

        // DB table to use
        $sTable = 'g';
        //

        $iDisplayStart = $this->input->get_post('iDisplayStart', true);
        $iDisplayLength = $this->input->get_post('iDisplayLength', true);
        $iSortCol_0 = $this->input->get_post('iSortCol_0', true);
        $iSortingCols = $this->input->get_post('iSortingCols', true);
        $sSearch = $this->input->get_post('sSearch', true);
        $sEcho = $this->input->get_post('sEcho', true);


         // Paging
        if(isset($iDisplayStart) && $iDisplayLength != '-1')
        {
            $this->db->limit($this->db->escape_str($iDisplayLength), $this->db->escape_str($iDisplayStart));
        }

        // Ordering
        if(isset($iSortCol_0))
        {
            for($i=0; $i<intval($iSortingCols); $i++)
            {
                $iSortCol = $this->input->get_post('iSortCol_'.$i, true);
                $bSortable = $this->input->get_post('bSortable_'.intval($iSortCol), true);
                $sSortDir = $this->input->get_post('sSortDir_'.$i, true);

                if($bSortable == 'true')
                {
                    $this->db->order_by($aColumns[intval($this->db->escape_str($iSortCol))], $this->db->escape_str($sSortDir));
                }
            }
        }





        if(isset($sSearch) && !empty($sSearch))
        {
            for($i=0; $i<count($aColumns); $i++)
            {
                $bSearchable = $this->input->get_post('bSearchable_'.$i, true);

                // Individual column filtering
                if(isset($bSearchable) && $bSearchable == 'true')
                {
                    $this->db->or_like($aColumns[$i], $this->db->escape_like_str($sSearch));
                }
            }
        }

        // Select Data
         $rResult=$this->db->query('select SQL_CALC_FOUND_ROWS reference,narration,accountnumber,amount,bank_name bank
       from  g join bank_data  on bank_data.bank_code =g.destinationcode')
        ;
           $iFilteredTotal =$rResult->num_rows();

        // Total data set length
        $iTotal = $rResult->num_rows();
      //  $iTotal = $this->db->count_all($sTable);

        // Output
        $output = array(
            'sEcho' => intval($sEcho),
            'iTotalRecords' => $iTotal,
            'iTotalDisplayRecords' => $iFilteredTotal,
            'aaData'=>array()
        );


        foreach($rResult->result_array() as $aRow)
        {
            $row = array();

            foreach($aColumns as $col)
            {
                $row[$col]=$aRow[$col];
            }

            $output['aaData'][]=$row;
        }

        echo json_encode($output);



    }
{"sEcho":0,"iTotalRecords":22631,"iTotalDisplayRecords":22631,"aaData":[{"reference":"0015432969","narration":"BVFFEEW","accountnumber":"gfhfhf","amount":"100.00","bank":"NANJK"}