Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Customfield with select2 closes while editing

Yury Shashkin September 2, 2020 edited

Hi!

I'm working with new customfield type where options go from ajax.

My code:

#disable_html_escaping()
#customControlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams)

#set ($field_uid = $customField.id)

<input class="issue-link-field single long-field" id="${field_uid}" name="${field_uid}"/>

<script>

AJS.$("#${field_uid}").auiSelect2({
ajax: {
url: function (params) {
return '/rest/croc-service-import/1.0/configuration-unit/search?str=' + params;
},
results: function (data, page) {
var confunits = [];
jQuery.each(data, function (index, value) {
var id = value["key"];
var text = value["name"];
confunits.push({id: id, text: text});
});
return {
results: confunits
};
}
}
});
AJS.$("#${field_uid}").select2('data', {id: "$key", text: "$name"});


</script>
#customControlFooter ($action $customField.id $fieldLayoutItem.fieldDescription $displayParameters $auiparams)

The problem is that if I click edit in issue, the editing closes at the moment select2 opens.  So I cannot save anything. Screens of this attached. Are there any ideas what can I do with it?screen.PNG screen1.PNG

 

2 answers

0 votes
KC Wong
Contributor
June 5, 2022

Did you ever find a solution? 

I have implemented a custom field type using select2, and on quick edit, it only closes on a specific project but not another. 

0 votes
Attila Czegledi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 3, 2020 edited

Hi,

I new here. May I ask, why are you using <input> instead of <select> ?

Yury Shashkin September 4, 2020

Hi!

Because I can't use select for ajax statements. As said in official select2 doc - use imput tag for ajax.

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, out of office, loom, confluence, async collaboration, meeting recaps, remote teamwork, team alignment, knowledge sharing, AI-powered notes, productivity tools, workforce continuity, teamwork collection

Put your meeting notes on autopilot with Loom + Confluence

AI-powered meeting notes keep work moving even if you’re out of the office. Enjoy your well-deserved time off and return refreshed, confident you’ll catch up in no time.

Learn more
AUG Leaders

Atlassian Community Events