Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I ensure that my event handlers are re-attached when I cancel the inline editing of a custom field?

Thomas Keller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2015

So I have a custom field that comes with some JS magic to show additional information. This JS magic, however, is completely dysfunctional after a user cancels the inline editing of my custom field. How can I re-attach my event handlers since JIRA.Events.NEW_CONTENT_ADDED does not seem to get fired when the editor is removed from the page?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Thomas Keller
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2015

After debugging myself through JIRA's inline editing capabilities I finally found an event to hook into: BEFORE_INLINE_EDIT_CANCEL!

Since, as the name suggests, it is however called before the inline editing is canceled (and therefore before the view's "saved" HTML is put back in place where the editor resided), one needs to do a timeout hack to actually run custom code in time:

JIRA.bind(JIRA.Events.BEFORE_INLINE_EDIT_CANCEL, function (e1, ctx) {
    window.setTimeout(rebindEventHandlers, 100);
});

I wish this (and many other JIRA.Events) would be better documented - right now I can only find documentation for NEW_CONTENT_ADDED - and I wish Atlassian would introduce some INLINE_EDIT_CANCELED or alike event that runs after the view HTML has been put back in place.

TAGS
AUG Leaders

Atlassian Community Events