KoolReport's Forum

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

Links from cards to functions #2245

Open Richb201 opened this topic on on Aug 4, 2021 - 8 comments

Richb201 commented on Aug 4, 2021

I have a dashboard that opens at the start of my app. Here is an image.

Can I set up a link so that if a user clicks on Cost Centers they are linked to my function that sets up cost centers?

Richb201 commented on Aug 5, 2021

I got it working for the cards. Is it possible to get that same type of link to work for PieChart

  PieChart::create(array(
                        "title"=>"% of total $ by risk",
                        "dataSource"=>$this->dataStore("titles_pie2"),
                        "columns"=>array("risk","total_wages"),
                        "options"=>array("is3D"=>true),
                        "forceIFrame"=>true
                    )
Sebastian Morales commented on Aug 6, 2021

Which chart package does your PieChart belong to? Can you use its click or select event to call a js function? Rgds,

Richb201 commented on Aug 6, 2021

I am using Google pie charts. Can you elaborate on how to use click to call a js function?

Sebastian Morales commented on Aug 6, 2021

Pls try this:

            google\PieChart::create(array(
                ...            
                "clientEvents" => [
                  "select" => "function(e) { 
                      console.log('piechart select', e); 
                      //call your function here
                  }",
                ]
            )); 
Richb201 commented on Aug 6, 2021

What do you mean by "call your function here"? My function is in Configure/titles_management

          PieChart::create(array(
                    "title"=>"% of total $ by risk",
                    "dataSource"=>$this->dataStore("titles_pie2"),
                    "columns"=>array("risk","total_wages"),
                    "options"=>array("is3D"=>true),
                    "forceIFrame"=>true,
                    "clientEvents" => [
                        "select" => "function(e) { 
                  console.log('piechart select', e); 
                  //call your function here
              }",
                    ] ) );
Richb201 commented on Aug 6, 2021
 PieChart::create(array(
                        "title"=>"% of total $ by risk",
                        "dataSource"=>$this->dataStore("titles_pie2"),
                        "columns"=>array("risk","total_wages"),
                        "options"=>array("is3D"=>true),
                        "forceIFrame"=>true,
                        "clientEvents" => [
                            "select" => "function(e) { 
                      console.log('piechart select', e); 
                      $this->'Configure/business_component_management'
                  }",
                        ]
                    )

            );

I am getting this error from the above code:

A PHP Error was encountered
Severity: Notice

Message: Undefined property: MyDashboard::$business_component_management

Filename: assets/MyDashboard.view.php

Line Number: 153

Backtrace:

File: /app/assets/MyDashboard.view.php
Line: 153
Function: _error_handler

File: /app/vendor/koolreport/core/src/KoolReport.php
Line: 502
Function: include

File: /app/application/controllers/Configure.php
Line: 176
Function: render

File: /app/application/controllers/Configure.php
Line: 147
Function: report_generator_amazing

File: /app/index.php
Line: 325
Function: require_once

Backtrace:

File: /app/assets/MyDashboard.view.php

I also tried $this->business_component_management I also tried

           <?php

                PieChart::create(array(
                        "title"=>"% of total $ by risk",
                        "dataSource"=>$this->dataStore("titles_pie2"),
                        "columns"=>array("risk","total_wages"),
                        "options"=>array("is3D"=>true),
                        "forceIFrame"=>true,
                        "clientEvents" => [
                            "select" => "function(e) { 
                      console.log('piechart select', e); 
                      business_component_management'
                  }",
                        ]
                    )

            );
            ?>

But this displays a blank box where the pie chart should be. Please help! I've tried every combo I can think of.

KoolReport commented on Aug 6, 2021

Please post us the code in line 153 of your MyDashboard.view.php

Richb201 commented on Aug 6, 2021

That is the line that has $this->function. That is why I am asking how to do that? The cards, by just using the function name, worked fine.

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