Loading Issue Tab Panels with AJAX
JIRA 5.0 changes the way in which tabs are rendered on the view issue page. Previously the
How do I enable AJAX loading of issue tab panels?
To enable AJAX loading for an issue tab, each <issue-tabpanel> must opt in by adding the <supports-ajax-load> element to its declaration in the
atlassian-plugin.xml. Here is an excerpt of the XML file that configures the JIRA's "All" issue tab:
The <supports-ajax-load> element controls whether JIRA will load this issue tab using an AJAX request.
What do I need to change in my plugin?
In many cases it will be sufficient to add the <supports-ajax-load> element each issue tab's declaration in the
atlassian-plugin.xml. However, there are two things that plugins may do that will prevent the AJAX loaded tabs from working correctly, namely:
- calling WebResourceManager.requireResource(String) from within the IssueTabPanel implementation, and
AJS.$(document).ready()and its variants.
If your plugin does any of these things, you should read the remainder of this section to understand the changes that are needed before enabling AJAX loading of your issue tab panel.
Uses of WebResourceManager.requireResource(java.lang.String)
Since IssueTabPanel.getActions(Issue, User) is now called in a separate request from the one that renders the view issue page, calling
To make sure that resources are included, use the jira.view.issue web resource context in your <web-resource> definition as in the following example.
Uses of AJS.$(document).ready()
JIRA.ViewIssueTabs.onTabReady() instead of using
This file should be changed to the following in order to work in JIRA 5.0.
What if my issue tab is already loaded asynchronously?
AjaxTabPanelAction class). These plugins will most likely want to suppress that mechanism when the issue tab is being loaded asynchronously by JIRA, so as to avoid a double AJAX request.
Issue tab panels that need this level of integration can implement the
IssueTabPanel2 interface to get more information about how the tab panel is being loaded. See the documentation for the
com.atlassian.jira.plugin.issuetabpanel package. The following code is an example of how the new interface can be used.