Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot assign onHidden function for Modal anymore #1937

Closed
mkrecek234 opened this issue Nov 16, 2022 · 4 comments · Fixed by #1938
Closed

Cannot assign onHidden function for Modal anymore #1937

mkrecek234 opened this issue Nov 16, 2022 · 4 comments · Fixed by #1938
Assignees

Comments

@mkrecek234
Copy link
Contributor

I have a modal which should trigger a callback after it is being hidden:
$this is a normal view.

$paymentmodal = \Atk4\Ui\Modal::addTo($this)->set(function ($v) use ($id, $model) {
                    \Atk4\Ui\Message::addTo($v, ['Test Modal.']);
                });

            // Reload view after closing of modal

            $paymentmodal->setOption('onHidden', new \Atk4\Ui\JsFunction([], [
                    (new \Atk4\Ui\JsChain('atk.modalService'))->removeModal(new \Atk4\Ui\Jquery()),
                    $this->JsReload(),
                ])
            );

In the recent version upon load of this view I now get this JavaScript error:
Error: Fomantic-UI "modal.onHidden" setting cannot be customized outside atk
jquery.min.js:2:31711

@mvorisek
Copy link
Member

The exception saves you from state corruption, but like in FUI API we can impl. specific handler for the onHidden to call both (your/custom and out/atk).

@mkrecek234
Copy link
Contributor Author

@mvorisek Can I not as before just connect to any FUI function? There are plenty of function for FUI controls where we need to connect our own Atk4 code. How can we solve this?

@mvorisek
Copy link
Member

mvorisek commented Nov 16, 2022

@mkrecek234 you can, but there are a few function that atk4/ui override to customize Fomantic-UI behaviour - this is not new, only since a few weeks we throw a JS exception properly :)

see #1917

do you need to change only onHidden or any other callback we override? I will impl. it, but it is not easy as for every function the side effects needs to be analysed manually to "merge" the callback correctly.

@mkrecek234
Copy link
Contributor Author

I only encountered this error when using modal onHidden. Sure there are other FUI functions (mostly onChange of values of some controls, but there are no existing overrides by atk, so no throw of exception that I encountered 👍

onHidden for Modal (or even JsModal) would be indeed very important as we have to be able to react on it to update views etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants