laravel yajra / laravel-datatables的表格问题中没有数据

时间:2016-11-22 11:19:57

标签: laravel datatables

我正在使用https://github.com/yajra/laravel-datatables/包 通过ajax请求在html表中显示数据,这是我的设置

路线

   Route::get('dashboard/initiation-by-org', ['uses' =>'DashboardController@showTotalInitiationByOrganization']);

控制器

public function showTotalInitiationByOrganization(){
    $litigation = collect(Dashboard::countLitigationsOfAnOrganizationByCountry());
    return Datatables::of($litigation)->make(true);
}

致电数据表

 $('#organization-cases').DataTable({
            processing: true,
            serverSide: true,
            aaSorting: [],
            iDisplayLength: 6,
            iDisplayStart: 0,
            ajax: '/dashboard/initiation-by-org',
            "columns": [
                {'data': 'organization'},
                {'data': 'litigations'}
            ]
        });

**My json response**


 {
          "draw": 0,
          "recordsTotal": 2,
          "recordsFiltered": 2,
          "data": [
            {
              "organization": "Shakti Samuha",
              "litigations": 1
            },
            {
              "organization": "CWIN",
              "litigations": 1
            }
          ],
          "input": [

          ]
        }

我的表

 <table id="organization-cases" class="table table-bordeard">
   <thead>
    <tr>
      <th>Organization</th>
       <th>Litigations</th>
    </tr>
  </thead>
</table>

我已根据安装手册安装此软件包,但我的表格中没有任何数据。 请告诉我这个问题有什么问题?

由于 Manoz

0 个答案:

没有答案