DataTable服务器端未返回数据

时间:2018-09-10 01:51:26

标签: cakephp datatable server-side

我是rendering a datatable,现在是serverside enabled。我想渲染从September 2018 and onwards创建的数据。下面的代码返回从2018年9月开始创建的数据。

if($role == "supply_head" || $role == "supply_staff" || $role == "warehouse_head_supply") {
        $options['conditions']=['PurchaseOrder.warehouse_received'=>$status,
                                'PurchaseOrder.type'=>['supply'],
                                'PurchaseOrder.status !='=>['cancelled', 'void', 'ongoing']];
    }
    elseif($role == "raw_head" || $role == "warehouse_head_raw") {
        $options['conditions']=['PurchaseOrder.warehouse_received'=>$status,
                                'PurchaseOrder.type'=>['raw'],
                                'PurchaseOrder.status !='=>['cancelled', 'void', 'ongoing']];
    }
    else {
        $options['conditions']=['PurchaseOrder.warehouse_received'=>$status,
                                'PurchaseOrder.status !='=>['cancelled', 'void', 'ongoing']];
    }
    $options['conditions']=['AND'=>['YEAR(PurchaseOrder.created) >='=>'2018',
                                    'MONTH(PurchaseOrder.created) >='=>'09']];
    $options['contain'] = ['Supplier'];
    $options['fields'] = ['PurchaseOrder.id', 'PurchaseOrder.si_number',
                          'PurchaseOrder.warehouse_received',
                          'PurchaseOrder.supplier_id',
                          'PurchaseOrder.po_number', 'Supplier.name',
                          'PurchaseOrder.created'];

但是,在服务器端数据表上实现时,不会呈现该表。停留在处理过程中,即使在获取数据时也返回“ 未找到”错误。

{
    "name": "Not Found",
    "message": "Not Found",
    "url": "\/purchase_orders\/serverside_receive_warehouse_list.json"
}

删除以下代码:过滤数据的代码后,表格已正确呈现。

 $options['conditions']=['AND'=>['YEAR(PurchaseOrder.created) >='=>'2018',
                                    'MONTH(PurchaseOrder.created) >='=>'09']];

0 个答案:

没有答案