diff --git a/src/TablesIgniter.php b/src/TablesIgniter.php index 642e0e1..d89be87 100644 --- a/src/TablesIgniter.php +++ b/src/TablesIgniter.php @@ -176,7 +176,7 @@ private function extraConfig($bui){ /** * 取得完整的Datatable Json字串 */ - public function getDatatable(){ + public function getDatatable($isJson=true){ if($result = $this->getQuery()){ $data = array(); foreach ($result->getResult('array') as $row){ @@ -188,9 +188,9 @@ public function getDatatable(){ "recordsFiltered" => $this->getFiltered(), "data" => $data ); - return json_encode($output); + return $isJson ? json_encode($output) : $output; } return $data; } -} \ No newline at end of file +}