-
-
Save JelteMX/2fa80d639869cc3b332ad366c76eb2bc to your computer and use it in GitHub Desktop.
Reload languages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var identifier = '.languageButton'; | |
// We use this to make sure jQuery is loaded | |
$(function () { | |
var $buttonEls = $(identifier); | |
if ($buttonEls) { | |
$buttonEls.each(function () { | |
var $this = $(this); | |
var buttonWidget; | |
try { | |
buttonWidget = dijit.registry.byNode($this.get(0)); | |
} catch (e) { | |
console.error('Cannot find widget with class: ' + identifier); | |
} | |
if (buttonWidget) { | |
buttonWidget.connect(buttonWidget, 'onAfterAction', function () { | |
// window.reloadHandler.reloadPage(); | |
mx.reloadWithState(); | |
}); | |
} else { | |
console.log('Cannot find widget for', $this); | |
} | |
}) | |
} | |
}); |
Hi Jelte,
We tried implementing the mx.reloadWithState(); function, but the problem is that it looks like the reloaded page is opened 'on top' of the old page, so when you close the page, it looks like nothing happens. My guess is that the new page is actually closed, but then the old page is shown again (the old page is also in the new language, though). So for a user, it looks like nothing happens after the first click on the Close button. After a second click on the Close button, the page is closed. We've seen this same behaviour when a page is refreshed from the modeler after running locally (probably the same function is called then?).
Any solution for this problem?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
trying this in mendix 7.10 gave an error on
Uncaught (in promise) TypeError: mx.reloadWithState is not a function
trying this in mendix 7.18 doesn't fire the function attached to the "onAfterAction"
What I'm doing wrong?