yajra/laravel-datatables-buttons

Keep original type in exportable array

FabienLucini opened this issue · 1 comments

$data = $this->decodeContent($data);

Hi, it seems that you are always returning strings here, but if we want an excel sheet to be correctly formatted with numbers for example, we should return the original variable type.

You could do this for example :

if ($type == 'exportable') {
    $dataType = gettype($data);
    $data     = $this->decodeContent($data);
    settype($data, $dataType);

    $title    = $this->decodeContent($title);
}
yajra commented

@FabienLucini sorry for late response, can you submit a PR on your proposed solution? Thanks!