KoolReport's Forum

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

Drilldown through a table #338

Open Paul Dungey opened this topic on on Jun 28, 2018 - 8 comments

Paul Dungey commented on Jun 28, 2018

I've changed your drilldown Sale By Time example so that the second level is a table instead of a chart. Now I can't drilldown to the 3rd level as there is nothing to click on in the table.

how do I enable drilldown through a table please? My code is below.

        <?php
        DrillDown::create(array(
            "name"=>"saleDrillDown",
            "title"=>"Sale Report",
            "btnBack"=>true,
            "dataSource"=>(
                $this->src('automaker')
                ->query("SELECT amount, paymentDate FROM payments")
                ->pipe(new CopyColumn(array(
                    "year"=>"paymentDate",
                    "month"=>"paymentDate",
                    "day"=>"paymentDate",
                )))
                ->pipe(new DateTimeFormat(array(
                    "year"=>"Y",
                    "month"=>"m",
                    "day"=>"d",
                )))
            ),
            "calculate"=>array(
                "sum"=>"amount"
            ),
            "levels"=>array(
                array(
                    "groupBy"=>"year",
                    "widget"=>array(ColumnChart::class,array(
                        "columns"=>array("year","amount"=>array(
                            "label"=>"Amount",
                            "prefix"=>'$'
                        )),
                        "colorScheme"=>array("#3b9b00"),
                    )),
                    "title"=>"All Years",
                ),
                array(
                    "groupBy"=>"month",
                    "widget"=>array(Table::class,array(
                        "columns"=>array(
						"month"=>array(
            "label"=>"Month"
				            ),
        "amount"=>array(
            "type"=>"number",
            "label"=>"Amount",
            "prefix"=>"$"
                    )), # End of columns
                    "title"=>function($params)
                    {
                        return "Year ".$params["year"];
                    },
					)),
                ),
                array(
                    "groupBy"=>"day",
                    "widget"=>array(ColumnChart::class,array(
                        "columns"=>array("day","amount"=>array(
                            "label"=>"Amount",
                            "prefix"=>'$'
                        )),
                        "colorScheme"=>array("#e0dc00"),
                    )),
                    "title"=>function($params)
                    {
                        return date('F', mktime(0, 0, 0, $params["month"], 10));
                    },
                ),
            ),
        ));
        ?>
KoolReport commented on Jun 29, 2018

I see the issue, it is because we have not implemented drilldown on table widget. In the next version of DrillDown, table will work like any other charts in drilldown. We are sorry about this inconvenience and please give us a little time. The ETA will be 2 weeks.

Paul Dungey commented on Jun 29, 2018

Thank you!

KoolReport commented on Jul 15, 2018

Hi Paul,

It is great news that we have just released DrillDown 2.0.0 and KoolReport 2.78.0. In this version, DrillDown is able to work with Google Chart, Table and ChartJs.

Please download new version.

Any issue, please let us know.

Regards,

KoolPHP Inc

Paul Dungey commented on Jul 16, 2018

Thanks. I've downloaded the new version.

Do you have any documentation on how to apply this new feature? How would I adapt my code above to allow the drilldown in the table?

KoolReport commented on Jul 16, 2018

Hi.

Here is the example:

...
"levels"=>array(
    array(
        "groupBy"=>"year",
        "widget"=>array(ColumnChart::class,array(
            "columns"=>array("year","amount"),
            "title"=>"Years"
        )),
        "title"=>"All Years",
    ),
    array(
        "groupBy"=>"month",
        "widget"=>array(Table::class,array(
            "columns"=>array("month","amount"),
            "cssClass"=>[
                "table"=>"table table-hover"
            ]
        )),
        "title"=>function($params)
        {
            return "Year ".$params["year"];
        },
    ),
    array(
        "groupBy"=>"day",
        "widget"=>array(Table::class,array(
            "showFooter"=>true,
            "columns"=>array("day","amount"=>array(
                "footer"=>"sum",
            ))
        )),
        "title"=>function($params)
        {
            return date('F', mktime(0, 0, 0, $params["month"], 10));
        },
    ),
),
...

So you see in the second level, we use the Table::class

Anuradha commented on Sep 12, 2019

Hello Can i open Drill down separately not on the same report?

Richb201 commented on Jul 12, 2022

Hi. I see this comment about DrillDown is from a few years ago. Buty I do not see DrillDown documented in the current manual. Does Drilldown work? Where is it documented?

Sebastian Morales commented on Jul 13, 2022

Pls check this link for DrillDown documentation:

https://www.koolreport.com/docs/drilldown/drilldown/

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

DrillDown