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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Marketplace Apps

Three tips for boosting your board's efficiency with Story Maps

Trello is one of the most effective tools for driving your sprints. It's customizable for every Agile team and product owners and Scrum masters (SM) love it. However, Agile teams often struggle with:...

834 views 2 9
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