I want to create a custom field that renders the same way as components and versions. I believe that drop-down is of type select2.
Is there a way I can do that? Are there any examples?
Thank-you
Community moderators have prevented the ability to post new answers.
Thanks for the help. I am putting what I ended up with in case it helps others. Also suggestions to improve would be great as I am not a javascript expert.
This is pasted into the announcement banner.
<script type="text/javascript">
(function($){
$(document).ready(function(){
function convertField(id) {
if (id.length===1){
new AJS.MultiSelect({
element: id,
itemAttrDisplayed: "label",
errorMessage: AJS.params.multiselectComponentsError
});
}
}
AJS.toInit(function() {
console.log("DEBUG: Init Event");
var main_window=AJS.$("#issue-create select[name=customfield_11711]")
convertField(main_window);
});
JIRA.bind(JIRA.CONTENT_ADDED_REASON.inlineEditStarted, function (e, context,reason) {
console.log("DEBUG: inline editing");
var main_window=AJS.$(".inline-edit-fields select[name=customfield_11711]")
convertField(main_window);
});
$(document).bind('dialogContentReady', function(event, dialog) {
console.log("DEBUG: Pop-up window created");
var pop_up_window=AJS.$(".jira-dialog select[name=customfield_11711]")
convertField(pop_up_window);
});
});
})(AJS.$);
</script>
Thanks for the reply. Does this solution allow you to type in values you want to add to the database for the custom field just like if you are adding to a new component?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I thnk there are a couple of plugins that add these, but it's also pretty simple to do it with javascript: https://answers.atlassian.com/questions/43534
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.