KoolReport's Forum

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

Add empty row? #74

Open zenon opened this topic on on Aug 14, 2017 - 1 comments

zenon commented on Aug 14, 2017

Hi KoolReport,

My table has 10 columns, for example, and on top there is the header.

How can I add an empty row just below the header, with, lets say 5 columns, that span across the table?

Appreciate your help.

Thanks.

KoolReport commented on Aug 16, 2017

Sorry for my late reply. It is possible, you can add any extra data to the end or at beginning of data. The solution is you use another array data source to pipe an empty row to the data pipeline.

Here is an example:


class MyReport extends \koolreport\KoolReport
{
    function settings()
    {
        return array(
            "dataSources"=>array(
                "mainSource"=>array(
                    "connectionString"=>"mysql:host=localhost;dbname=automaker",
		    "username"=>"root",
                    "password"=>"",
                    'charset' => 'utf8',
                ),
                "dummySource"=>array(
                    "class"=>'\koolreport\datasources\ArrayDataSource',
                    "data"=>array(
                        array(
                            "customerName"=>"",
                            "customerId"=>"",
                        )
                    )
                )
            )
        );
    }


    function setup()
    {
        $this->src("dummySource")
        ->pipe(new ColumnMeta(array()))
        ->saveTo($pipeline);

        $this->src("mainSource")
        ->select("select customerName,customerId from customers")
        ->pipe($pipeline)
        ->pipe($this->dataStore("customers"));
    }
}

The effect is that you pipe an empty row from dummySource to $pipeline then the mainSource continue to pipe real data to $pipeline. As a result, your will have data table which has empty row at first.

Hope that helps.

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

None