ajaxChosen plugin will not work

a 夏天 提交于 2019-12-05 18:23:19

After some further research I found out that this plugin isn't actively supported anymore.

It seems that Michael Perrin forked it to be compatible with 1.X versions of chosen: https://github.com/michaelperrin/ajax-chosen/

Michael's fork works, but still is a bit buggy. In the example of Michael, my main problem was that some typed letters were being dropped after a matching result was found. Unexpected behavior!

Maybe it would be best to give Select2 another chance, since its users claim that they can circumvent the lagginess of the plugin, when dealing with large lists.

This plugin is supported actively and is widely used. Maybe it would be best to lay our eggs in that basket ;-)

The issues about slowness of Select2 can be found here.

I had the same problem, no Ajax request launched. After a bit of investigation, I found that if your select is empty, chosen disable the search function.

Add this to chosen options : disable_search_threshold: -1

your code should look like this :

$("selector").ajaxChosen({
    // AJAX & AjaxChosen OPTIONS
    type: 'GET',
    url: "/My/url.php",
    dataType: 'json'
},
function (data) {
    // CALLBACK
    var results = [];
    // [...]
    return results;
}, 
{
    // CHOSEN OPTIONS
    disable_search_threshold: -1
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!