KoolReport's Forum

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

Drilldown not working with first level as table and second level as table #886

Open Rajesh opened this topic on on May 24, 2019 - 4 comments

Rajesh commented on May 24, 2019

Hello KoolReport,

We need to implement drill down on table. We created two separate tables for this report. Below is the code for the report which is working with Level1 as ColumnChart and Level2 as Table. When clicked on ColumnChart, it does drill down to the table but when we replace the first level to table from ColumnChart then the Level1 table is displayed but drill down does not work on this table. Could you please let us know if drilldown is supported or not with first level as table?

<?php
    DrillDown::create(array(
        "name"=>"DrillDown",
        "levels"=>array(
            array(
                "title"=>"All BusinessLines",
                "content"=>function($params,$scope)
                {
                    ColumnChart::create(array(
                        "dataSource"=>(
                            $this->src("DatabaseName")->query("
                                SELECT [businessLine]
					      ,[recordDate]
	                                      ,CONVERT(DECIMAL(15,0),[prevDayRevenue]) AS prevDayRevenue
					     ,CONVERT(DECIMAL(15,0),[avg7DayRevenue]) AS avg7DayRevenue
				FROM Level1
				WHERE recordDate = (SELECT MAX(recordDate) FROM Level1)
                            ")
                        ),
                        "columns"=>array(
		    "businessLine",
		"prevDayRevenue" =>array(
				"type"=>"number",
                                "label"=>"prevDayRevenue",
                                "prefix"=>"$",
                            ),
		"avg7DayRevenue"=>array(
				"type"=>"number",
                                "label"=>"avg7DayRevenue",
                                "prefix"=>"$",
                            ),
		),
                        "clientEvents"=>array(
                            "itemSelect"=>"function(params){
                                DrillDown.next({businessLine:params.selectedRow[0]});
                            }",
                        ),
						"cssClass"=>array(
            "table"=>"table table-hover table-tr"
        )
                    ));
                }
            ),
            array(
                "title"=>"All Advertisers",
                "content"=>function($params,$scope)
                {
                    Table::create(array(
                        "dataSource"=>(
                            $this->src("DatabaseName")->query("
                                SELECT [businessLine]
					     ,advertiserName
					     ,[recordDate]
					     ,CONVERT(DECIMAL(15,0),[prevDayRevenue]) AS prevDayRevenue
					     ,CONVERT(DECIMAL(15,0),[avg7DayRevenue]) AS avg7DayRevenue
				FROM Level2
				WHERE recordDate = (SELECT MAX(recordDate) FROM Level2)
									AND businessLine = :businessLine
                            ")
                            ->params(array(
                                ":businessLine"=>$params["businessLine"]
                            ))
                        )
                        ,
                        "columns"=>array(
		"advertiserName",
		"prevDayRevenue" =>array(
								"type"=>"number",
                                "label"=>"prevDayRevenue",
                                "prefix"=>"$",
                            ),
		"avg7DayRevenue"=>array(
								"type"=>"number",
                                "label"=>"avg7DayRevenue",
                                "prefix"=>"$",
                            ),
		)
                    ));
                }                
            )
        ),
        "themeBase"=>"bs4",
    ));
    ?> 

Thanks, Rajesh.

Rajesh commented on Jul 11, 2019

Hello Koolreport,

Could you please respond to my question?

Thanks,

Rajesh.

KoolReport commented on Jul 12, 2019

In the first level Table you should use the rowSelect client event instead of itemSelect of ColumnChart.

Rajesh commented on Jul 15, 2019

Thanks KoolReport for the response. rowSelect did not work but changing it to rowClick solved the table drilldown issue. Below code resolved our problem.

"rowClick"=>"function(params){
					DrillDown.next({businessLine:params.rowData[0]});
				}",

Thank you again!

KoolReport commented on Jul 16, 2019

Great!

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