есть ли опция в select2, чтобы проверить, в каком элементе пользователь ищет? - PullRequest
0 голосов
/ 22 июня 2019

Я использую select2 v3.5.3, мне было интересно, есть ли один вариант, чтобы проверить, какой элемент изменяется

Я пытался получить информацию об элементе с $ (this), но без информации,также я уже проверил документацию, но кажется, что нет опции для этого

        allowClear: true,
        ajax: {
            url: '/request/filter_results/',
            dataType: 'json',
            quietMillis: 250,
            data: function (term, page){
                console.dir($(this));
                return {
                    q: term, // search term
                    field_selected: $(this).attr('data-field')
                };
            },```

It should return the id of the element, i.e. if I'm writing inside the element id_one it should send this info to the server
...