Hi there,
currently i'm upgrading a Plugin to JIRA 9.+ and im facing the Problem,
that, what ever i configure AJS isn't loaded. The same happens to jQuery.xyz
The AJS.toInit Block is included in the vm template, as well as the required commands.
We also defined a web-resource including AJS as a dependency.
$webResourceManager.requireResourcesForContext("com.atlassian.auiplugin:ajs")
$webResourceManager.requireResource("com.atlassian.auiplugin:ajs")
AJS.toInit(function(){
jQuery(document).ready(function() {
doInitialStuff();
});
});
Does anyone have any suggestions where I can look for the source of the problem?
Thanks
With some guidance from the official support i found this as a solution:
In your template add two script sections one as module the other as text/javascript.
The module contains only the AJS.toInit while the other contains all other functions and the check if AJS is defined.
The module block is only executed once, the other is for the remaining runtime.
<script type="module">
AJS.toInit(function(){
jQuery(document).ready(function() {
initStuff();
});
});
</script>
<script type="text/javascript">
function initStuff() {
// do some magic
}
if (typeof jQuery != "undefined") {
jQuery(document).ready(function() {
initStuff();
});
}
</script>
Thank you @Philipp Kriegel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If I add both code blocks things run twice.
The module code block is new to me and worked a treat :)
Thanks @Philipp Kriegel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello @Philipp Kriegel ,
How did you managed to solved this issue ??
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
sorry for the late reply. I've missed the notification.
In the end the support of Atlassian asked me to confirm something.
Using the code block from the support with some other blocks i found in other sources i found a solution that worked for us.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.