diff --git a/demos/_unit-test/callback-nested.php b/demos/_unit-test/callback-nested.php index 5d4e9a569e..71f698e31d 100644 --- a/demos/_unit-test/callback-nested.php +++ b/demos/_unit-test/callback-nested.php @@ -27,24 +27,33 @@ $loader = Loader::addTo($app); $loader->loadEvent = false; -$loader->set(function ($p) use ($m) { - $loader_1 = Loader::addTo($p); - $loader_1->loadEvent = false; +$loader->set(function (Loader $p) use ($m) { + if (!empty($_GET['err_main_loader'])) { + throw new Exception('Exception from Main Loader'); + } + + $loaderSub = Loader::addTo($p); + $loaderSub->loadEvent = false; Header::addTo($p, ['Loader-1', 'size' => 4]); - $loader_1->set(function ($p) use ($m) { + $loaderSub->set(function (Loader $p) use ($m) { + if (!empty($_GET['err_sub_loader'])) { + throw new Exception('Exception from Sub Loader'); + } + Header::addTo($p, ['Loader-2', 'size' => 4]); - $loader_3 = Loader::addTo($p); - $loader_3->set(function ($p) use ($m) { + $loaderSubSub = Loader::addTo($p); + + $loaderSubSub->set(function (Loader $p) use ($m) { Header::addTo($p, ['Loader-3', 'size' => 4]); $c = Crud::addTo($p, ['ipp' => 4]); $c->setModel($m, [$m->fieldName()->name]); }); }); - \Atk4\Ui\Button::addTo($p, ['Load2'])->js('click', $loader_1->jsLoad()); + \Atk4\Ui\Button::addTo($p, ['Load2'])->js('click', $loaderSub->jsLoad()); }); \Atk4\Ui\Button::addTo($app, ['Load1'])->js('click', $loader->jsLoad()); diff --git a/src/Loader.php b/src/Loader.php index dbff967ea7..74f8508a49 100644 --- a/src/Loader.php +++ b/src/Loader.php @@ -21,7 +21,7 @@ class Loader extends View public $shim; /** - * Specify which event will cause Loader to begen fetching it's actual data. In some cases + * Specify which event will cause Loader to begin fetching it's actual data. In some cases * you would want to wait. You can set a custom JavaScript event name then trigger() it. * * Default value is `true` which means loading will take place as soon as possible. Setting this