diff --git a/src/Chumper/Datatable/Engines/BaseEngine.php b/src/Chumper/Datatable/Engines/BaseEngine.php index b2554f1..5b7238c 100644 --- a/src/Chumper/Datatable/Engines/BaseEngine.php +++ b/src/Chumper/Datatable/Engines/BaseEngine.php @@ -218,7 +218,21 @@ public function showColumns($cols) else { $this->columns->put($property, new FunctionColumn($property, function($model) use($property){ - try{return is_array($model)?$model[$property]:$model->$property;}catch(Exception $e){return null;} + try + { + if (is_array($model)) + { + return $model[$property] == null ? $model[0] : $model[$property]; + } + else + { + return $model->$property == null ? $model[0] : $model->$property; + } + } + catch(Exception $e) + { + return null; + } })); } $this->showColumns[] = $property;