This is Select2 library
Checkbox normally works after double clicks. It carries out the Add and Delete operation.
But when I use the ajax multiselect checkbox, it can add but I cannot delete it through select.
When I want to delete, I can only delete it by pressing x on the top.
This is my code : https://codepen.io/tolga-kurtulu/pen/KKaOVXp?editors=1011
HTML
<select class="select2" style="width: 100%;" multiple="multiple"></select>
Javascript
$(document).ready(function() {
$("select.select2").select2({
closeOnSelect: false,
placeholder: "Placeholderr",
// allowHtml: true,
allowClear: true,
tags: true,
// debug: true,
ajax: {
url: "https://api.github.com/search/repositories",
dataType: 'json',
data: (params) => {
return {
q: params.term,
}
},
processResults: (data, params) => {
const results = data.items.map(item => {
return {
id: item.id,
text: item.full_name || item.name,
};
});
return {
results: results,
}
},
},
});
})
Aucun commentaire:
Enregistrer un commentaire