KoolReport's Forum

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

Dashboard loading with parameters #3250

Open Christian Voß opened this topic on on Feb 16 - 1 comments

Christian Voß commented on Feb 16

Hi,

I found another issue, which I'm not able to solve myself. On one of my dashboards I have a SimpleCard Widget, which has the following onClick function:

$this->onClick(function() use ($site_id, $schedule_version_id) {     
            return Client::dashboard("resourceBoard_" . $site_id)->load([
                'schedule_version_id' => $schedule_version_id,
                'tab' => 'resourceConflictsTable'
            ]);
        });

It does work very well, the dashboards is loaded and I can access the parameters. However, when I already load the dashboard with parameters in the App file, then the parameters from the onClick event are ignored.

This is how I load the board in the dashboards function of the App file

"Resourceboard" => resourceBoard::create()->icon("fas fa-users")->params([
            "site_id" => 2,    
        ]);

Since I added this parameter in the Add file, the parameters in the onClick event of the SimpleCard are not being forwarded to the dashboard anymore.

Is there anything I can do to accessall 3 parameters?

Thanks and best regards

Christian

KoolReport commented on Feb 20

Please assign the name to the ResourceBoard in App file dashboards function:

"Resourceboard" => resourceBoard::create()->name("resourceBoard_2")->icon("fas fa-users")->params([
            "site_id" => 2,    
        ]);

Also, in the onClick, please add the site id parameter as well:

$this->onClick(function() use ($site_id, $schedule_version_id) {     
            return Client::dashboard("resourceBoard_" . $site_id)->load([
                'site_id'=>$side_id, // Add this
                'schedule_version_id' => $schedule_version_id,
                'tab' => 'resourceConflictsTable'
            ]);
        });

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

Dashboard