You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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>
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.