inline edit on custom field loads multiples after every save.


I have been trying to get inline editing to work on my custom field plugin. After a lot of searching and trial and error I finally have it kind of working. However I have found the following issue and cannot figure it out.

I have the following javascript set at the top of my edit.vm file:

<script type="text/javascript">
AJS.$(function () {
	console.log("outer");
    JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e, context, reason) {
        console.log("inner");
        if (reason === 'inlineEditStarted') { 
	    console.log('inlineEditStarted');
            blueStepInitEdit();
        }
    });
    
    blueStepInitEdit();
});

</script>

The blueStepInitEdit() is a function in a js file that is loaded in the alt.general context so it is globally available.When I click the inline edit icon get the following in my javasript console:

inner
inlineEditStarted
I then click save and the console displays:
outer 
inner 
other 
inner 
other 
inner
other 
inner 
other 
inner 
other 
inner 
other 
inner 
other 
inner 
other

Not sure why it is calling my function so many times.

I click the inline edit icon as second time and get:

inner 
inlineEditStarted 
inner 
inlineEditStarted

Note that this time it called it twice. If I save rinse and repeat, it will call it three times etc.

Can someone shed some light on this? It is driving me crazy.

P.S. to Atlassian, having a soup to nuts inline editing tutorial with some AJS sprinkled in would be great!



1 answer

This widget could not be displayed.

I noticed the same thing, it looks like a bug, Atlassian, do you answer questions here any more????

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Jul 25, 2018 in Marketplace Apps

Jira Cloud and Bitbucket Cloud Integration with Microsoft Teams

One of the newest products in the Microsoft family - Microsoft Teams,  is a chat-based hub for teamwork that integrates all the people, content, and tools your team needs to be more engaged and ...

733 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you