KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Drilldown Multiview to PDF with CI3 #2816

Open Frederick Crisostomo opened this topic on on Sep 2, 2022 - 1 comments

Frederick Crisostomo commented on Sep 2, 2022

Good day! I want to export to PDF my report with subreport and Multiview Drilldown. Is it possible?

Sebastian Morales commented on Sep 14, 2022

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(...);

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None