Custom select list with popup dialog

Hi,

I'm a newbie in developing Jira plugins and I would like to implement a custom field which consists of a select list (combo) and a button. When pressing the button a dialog should be shown and allow to define a string which should be added to the options of the select list after pressing a button on the dialog.

I've defined the custom field with its new created class in the atlassian-plugin.xml file and added a velocity template which fills the select list and adds a button for showing the popup dialog.

What I would like to know if it's easily possible to add a new option entry directly to the OptionsManager and to the select list and selecting the new created entry.

Do you have any hints?

As a quick hack I did the following: I append the new option to the custom field in the button handler inside of the vm file. In the class of the custom field I've overwritten the method validateFromParams and add the new option to the OptionsManager if it's not already defined.

1 answer

0 votes

OptionsManager has the createOption method. I suspect you are already doing it but it is too late for the validation? If so, I don't see an issue with your hack.

I add the new option inside of the vm file (when I close the dialog) like:

AJS.$("#customfield_10000").append(new Option("A new entry", "A new entry"));

The new entry is then selectable within the select list, but not as part of the OptionsManager. So when the user selects the new created entry and confirms creating the issue I check the selected entry whether the OptionsManager contains it or not. If not, it will be added to the OptionsManager (with createOption).

Well, I hoped that there would be an easier approach to do it.

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,042 views 13 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot