Hi koolreport team!
I have been stuck with a simple issue but cannot find any solution because the logic of working the dashboard as a Whole application is a bit unclear for me.
So, I wish that the content of the dashboard can be updated depends on the parameter. Under the content I understand the set of widgets. For example I have 2 sets of wigets and I wish that one set can be visible if the parameter=1 and the second if the parameter=2.
Also I have a buttons that set the parameter. But this approach does not work. It looks like the content function is executed before I change the parameter with the button... Below is the part of my code
myBoard.php:
protected function content()
{
$Content1=[
//a lot of content1
Row::create([
MyButton1::create()->text('Content1')
]),
]
$Content2=[
//a lot of content2
Row::create([
MyButton2::create()->text('Content2')
]),
]
switch ($this->params("parameter")){
case 1:
$returnContent = $Content1;
break;
case 2:
$returnContent = $Content2;
break;
default:
$this->params(['parameter'=>1]);
$returnContent = $Content1;
}
return $returnContent;
}
myButton1.php:
class myButton1t extends Button
{
protected function actionSubmit($request, $response)
{
Client::dashboard('myBoard')->load(['parameter'=>2]);
}
}
I tried to debug the code and noticed that the content function does not execute when I call load method. Perhabs I am wrong but anyway my approach does not work So I need help.