KoolReport's Forum

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

CustomDrilldown through a table #463

Open Eric opened this topic on on Sep 12, 2018 - 5 comments

Eric commented on Sep 12, 2018

Hello,

How can I drilldown tru a table using custom drilldown. When I use a PieChart it works fine as follow:

PieChart::create(array(
        "dataStore"=>$this->dataStore('my_report'),
        "columns"=>array(
            "planner"=>array(
                "label"=>"Planners",
            ),
            "status"=>array(
                "label"=>"status",
            ),
        ),
        "clientEvents"=>array(
            "rowSelect"=>"function(params){
                  $drilldown.next({status:params.selectedRow[0]});
            }",
        ),
    ));

However when I use a table as follow nothing happens:

Table::create(array(
        "dataStore"=>$this->dataStore('my_report'),
        "columns"=>array(
            "planner"=>array(
                "label"=>"Planners",
            ),
            "status"=>array(
                "label"=>"status",
            ),
        ),
        "clientEvents"=>array(
            "rowSelect"=>"function(params){
                  $drilldown.next({status:params.selectedRow[0]});
            }",
        ),
    ));

Thanks,

KoolReport commented on Sep 12, 2018

On the Table event, you change from "rowSelect" to "rowClick"

Eric commented on Sep 12, 2018

When I use

 "rowClick"=>"function(params){
                  $drilldown.next({status:params.selectedRow[0]});
            }",

I get the javascript error below. 'selectedRow[0]' doesn't work

(index):245 Uncaught TypeError: Cannot read property '0' of undefined
    at Array.<anonymous> ((index):245)
    at KoolPHPTable.fireEvent (table.js:137)
    at KoolPHPTable.<anonymous> (table.js:21)
    at HTMLTableRowElement.dispatch (VM9514 jquery.min.js:3)
    at HTMLTableRowElement.q.handle (VM9514 jquery.min.js:3)

Thanks

Eric commented on Sep 12, 2018

Also, I've noticed that if I have multiple table on the same page, the "rowClick" event reference the first table on the page. Can I have multiple tables with each their own "rowClick" event? It looks like I need to use params[0] to get the selected value but {status:params[0]} doesn't seem to pass the value to the query..

Eric commented on Sep 12, 2018

I figured it out I need to use status:params.rowData[0]

Thanks,

KoolReport commented on Sep 12, 2018

That's great. About the event issue, it will be solved in the next version of KoolReport, our ETA is about the end of this month.

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