KoolReport's Forum

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

PDF export in Dashboard's table widget - show field value from table in another area #3225

Closed John opened this topic on on Jan 9 - 6 comments

John commented on Jan 9

I'm trying to show a field from a table column (customers) outside a table in a pdf report. Since i have selected customer (with an input widget) and this column is filled with the particular customer only, i don't want to show this column in an export but just a label with my selected customer at the upper area of my pdf export.

I made some trials based on these articles :

https://www.koolreport.com/forum/topics/40

https://www.koolreport.com/forum/topics/120

but i couldn't implement it... I suppose because mine is in Dashboard (while the examples are in core koolreport) and i can't use the datastore with the proposed way...

KoolReport commented on Jan 11

So I can understand that there is a different between web version and export version on a same report.

I suggest that you add a parameter to report called exportMode for example, when the exportMode is true then you customize the view file to match.

$report = new MyReport([
    "exportMode"=>true
]);

In the view file of MyReport


if(isset($this->params["exportMode"]))
{
    //do something
}

You also can use this condition to turn off a column in table.

Hope that helps.

John commented on Jan 12

Thanks, i tried your suggestion. As i wrote, i'm working on a Dashboard's table widget. So I added your code like this:

class MyTable extends Table
{
    protected function onInit()
    {
        $this
            ->pdfExportable([
				'engine' => 'CloudPdfEngine',
				'viewFile' => './export_views/TablePDF',
            ])
		->exportMode(true)

It showed me this error: Call undefined exportMode() method

John commented on Jan 19

Hi, is there any news for this?

Sebastian Morales commented on Jan 23

Pls try this one and let us know if it works or not:

    protected function onInit()
    {
        $this
            ->pdfExportable([
				'engine' => 'CloudPdfEngine',
				'viewFile' => './export_views/TablePDF',
                                'exportMode' => true,
            ])
John commented on Jan 25

Thanks, i tried it and the error fixed. But it showed me other error as i continued (null value) and i think the cause is that datastore in Dashboard is not implemented as in core. I follow the examples i wrote above, i mean something like this and it doesn't work:

$this->dataStore("my_data_store_name")->popStart();

John commented on Jan 25

Never mind, i thought a different workaround for my needs. Thanks anyway!

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
help needed

Export