Hi,
Is it possible to dynamically hide widget using hidden() property and toggle? Something like this?
class myDashboard extends Dashboard
{
return [
ShowHideToggle::create(),
$hide = Text::create("hide ")
->text(function(){
$showHideToggle = $this->dashboard()->widget("ShowHideToggle")->value();
if($showHideToggle == 1) {
return true;
}
return false;
})->asHtml(true),
Row::create([
myWidget::create()->hidden($hide ),
]),
];
}
// ShowHideToggle.php
class ShowHideToggle extends Toggle
{
protected function onCreated()
{
$this
->defaultValue(0)
->is3D(true)
->showText(false)
->onText("ON")
->offText("OFF")
->type("success")
->pill(false)
->size("md")
->cssClass("")
->cssStyle("margin-left:30px;");
}
protected function actionChange($request, $response)
{
}
}