lundi 3 mai 2021

Bug: Select2 Ajax Multiselect Checkbox Does't Delete (Deselect) When You Double Click(Toggle) On Select

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

enter image description here

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