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
Community showcase
Posted Oct 11, 2018 in Marketplace Apps

You + one app + a desert island...

Hi all! My name is Miles and I work on the Marketplace team. We’re looking for better ways to recommend and suggest apps that are truly crowd favorites, so of course we wanted to poll the Community. ...

3,451 views 6 6
Join discussion

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