KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

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

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

Rajesh commented on May 24

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

Hello Koolreport,

Could you please respond to my question?

Thanks,

Rajesh.

KoolReport commented on Jul 12

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

Rajesh commented on Jul 15

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

Great!

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

None