Hi everyone,
In JIRA 5.x we are hoping to run some custom JavaScript whenever the create issue or edit issue popup overlays are displayed... as well as when the content is reloaded from an AJAX request (e.g. a dropdown selection changes causing a reload)
We've tried code samples that trigger based on checking the window.location.href but these won't work as the parent page is the Dashboard or something else.
There was also some JIRA based jQuery events that we thought we could listen for but none seem to work.
Is there a specific JIRA Event that is fired when the create issue/edit issue overlays are loaded/re-loaded (via AJAX)?
For example this one doesn't seem to work;
AJS.$(document).bind('dialogContentReady', function(event, dialog) {...});
nor does this one
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context) {...});
Any suggestions? We had custom JavaScript working in version 4.3.4 but have not been able to get it to work in 5.x with the changes to the create/edit issue pages now rendering as overlays.
Any help is much appreciated! Thanks!
Community moderators have prevented the ability to post new answers.
This is known issue, check this i hope it will help you
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
You need to call the function once when the document is ready and when the NEW_CONTENT_ADDED event is fired.
Refer to https://answers.atlassian.com/questions/79201/jira-5-1-2-questions-re-pop-up-issue-edit-window for more information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for the reply. I tried the following simple code:
<script>
(function($) {
alert('on ready');
AJS.toInit(function(){
alert('in init');
});
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context) {
alert('content added');
});
})(AJS.$);
</script>
After the code is added to the description box of the custom field, I click the update button and it redirects me back to the list of all custom fields and then the popup alert is displayed.
I also tried the code below, and all of hte combinations, but either I did not get an alert popup or the alert popped up on the list of custom fields page, but still not the "create issue" page.
AJS.$(document){
alert('on ready');
});
AJS.toInit(function(){
alert('in init');
});
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context){
alert('content added');
});
Any suggestions?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It might have to do with page load ordering. I put all my stuff in the description of summary and that worked.
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.