inline edit on custom field loads multiples after every save.

JasonD June 12, 2014

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

0 votes
Terry Jeske June 15, 2014

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
TAGS
AUG Leaders

Atlassian Community Events