Hi again,
It seems that I've noticed another bug. CSS styling has no effect when the table is exported to PDF. Since it works fine when exported to JPG, I'm guessing the problem lies in export package itself. Here's the code:
//ReportController.php
$myReport = new MyReport($reportParams);
$result = $myReport->run();
if ($request->format === 'pdf') {
$result->export()->pdf(array(
"format"=>"A4",
"orientation"=>$report->visualization === 'table' || $report->visualization === 'pie' || $report->visualization === 'donut' ? 'portrait' : 'landscape',
"zoom"=>$report->visualization === 'table' ? '1' : '0.7',
))->toBrowser($report->title . ".pdf");
}
elseif ($request->format === 'jpg') {
$result->export()->jpg(array(
"width"=>"1024px",
"height"=>"768px",
))->toBrowser($report->title . ".jpg");
}
//MyReport.view.php
if (!empty($this->params['colors'])) {
$cssClass =
[
'table' => 'tableColor',
'td' => 'tableColor'
];
$columns = [];
foreach ($this->params['columns'] as $column) {
$columns[$column] = ['className' => 'tableColor'];
}
}
else {
$columns = $this->params['columns'];
}
Datatables::create([
'name' => 'uniqueTable',
'Title' => $this->params['title'],
'dataSource' => $dataSource,
'columns' => $columns,
'options' =>
[
'searching' => $searching,
'colReorder' => true,
'paging' => $paging
],
'serverSide' => $serverSide,
'cssClass' => $cssClass
]);
Is there any workaround?