Gadgets and Dashboards 2.0
Gadgets and Dashboards 1.0
This page describes the methods available in each type of gadget object. This page is part of the documentation on the Atlassian Gadget Library.
On this page:
this refers to the gadget and any of the following methods can be called on
Under the hood, the constructor method
AJS.Gadget(...) is a factory method that constructs a specific type of gadget depending on the config parameters passed in. The three kinds of gadgets are:
Each type is described below.
A Standard Gadget is constructed when a
view parameter is passed in but no
config parameter. This is useful when no configuration is needed for the gadget. An example is the Quick Issue Create gadget in JIRA.
All other gadget types extend the Standard Gadget type.
Displays a message in a dialogue box.
Saves user preferences locally and to the database. In order to persist these values and have them available when gadget is reloaded, the
setprefs feature must be declared as required in the gadget XML specification.
Toggles the class of the gadget to the specified view. This class is used to style the view accordingly.
Returns the current view mode as a string. For example
Helper function to get the context path for JIRA. Necessary for remote requests.
Gets user preference object.
Gets a preference by name.
Retrieves a user preference array.
Gets the i18n string from the included language bundles. Returns the key if it does not exist.
Gets the gadget object, wrapper
div for all gadget HTML (jQuery object).
Resizes the iframe to fit the content.
Shows an indicator that the gadget is loading.
Hides the loading indicator.
Stores a value in a cookie, unique to this gadget.
Retrieve a previously stored cookie value.
Removes a cookie value.
A Configured Gadget is constructed when
config parameters are passed in but the current user does not have permission to edit the gadget's preferences. The gadget contains a view and footer.
This gadget has all of the same methods as a Standard Gadget plus the following:
Gets the view object, wrapper
div for all view HTML (jQuery object). This object is a
div with the class of
"view" and is contained within the object returned from
Displays the view. When refreshing content, the view template is called. If not refreshing content, this method simply displays the currently rendered view.
Gets the footer object, wrapper
div for all footer HTML (jQuery Object). This object is a JQuery wrapped
div with the class of
"footer". It is contained within the object returned from
getGadget() and is displayed underneath the view.
A Configurable Gadget is constructed when
config parameters are passed in and the current user has permission to edit the gadget's preferences. The gadget contains a view, a footer and a configuration screen.
This gadget inherits all of the methods from Configured Gadget plus the following:
Displays the configuration screen with all fields defined during construction.
Gets the config form object, wrapper
div for all config HTML (jQuery Object). It is contained within the object returned from