Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Pls try Multiview's client events:
https://www.koolreport.com/docs/drilldown/multiview/#properties-client-events
You could add a pdf button and catch the event when it's clicked. In that event listener you could send a form submit to export a pdf view corresponding with the current view index:
//MyReport.view.php
<form action="export.php" method="post">
<input type="hidden" name="viewIndex" />
<?php
MultiView::create(array(
...
"clientEvents"=>array(
"changing"=>"function(params){
if (isPDFButton) {
var hiddenInput = document.querySelector("#viewIndex");
hiddenInput.value = params.index;
document.forms[0].submit();
}
else return true;
}",
);
));
?>
</form>
//export.php
$viewIndex = $_POST["viewIndex"];
$pdfViewName = ...; //"MyReportPDFChart", "MyReportPDFTable", etc, based on $viewIndex,
$report = new MyReport();
$report->run()->export($pdfViewName)->pdf(...)->toBrowser(...);
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo